code: def check_partial_index(
      n_samples, test_size, train_size, n_test, n_train
  ):
      """Check that folds can be constructed from passed arguments."""
      if n_test + n_train > n_samples:
          raise ValueError(
              "The selection of train (%r) and test (%r) samples "
              "lead to a subsets greater than the number of "
              "observations (%i). Implied test size: %i, "
              "implied train size: "
              "%i."
              % (test_size, train_size, n_samples, n_test, n_train)
          )
  
      for n, i, j in zip(
          ("test", "train"), (n_test, n_train), (test_size, train_size)
      ):
          if n == 0:
              raise ValueError(
                  "The %s set size is 0 with current selection ("
                  "%r): "
                  "cannot create %s subset. Assign a greater "
                  "proportion of samples to the %s set (total "
                  "samples size: %i)." % (i, j, i, i, n_samples)
              )
  
      if n_samples < 2:
          raise ValueError(
              "Sample size < 2: nothing to create subset from."
          )
  
imports: from __future__ import division
  from numbers import Integral
  import warnings
label_desc: Use image node_id 2 for calling a global function with example usage: check_partial_index(n_samples, test_size, train_size, n_test, n_train) without return types