code: def check_full_index(n_samples, folds, raise_on_exception):
      """Check that folds can be constructed from passed arguments."""
      if not isinstance(folds, Integral):
          raise ValueError(
              "'folds' must be an integer. "
              "type(%s) was passed." % type(folds)
          )
  
      if folds <= 1:
          if raise_on_exception:
              raise ValueError(
                  "Need at least 2 folds to partition data. "
                  "Got %i." % folds
              )
          else:
              if folds == 1:
                  warnings.warn(
                      "'folds' is 1, will return full index as "
                      "both training set and test set."
                  )
      if folds > n_samples:
          raise ValueError(
              "Number of splits %i is greater than the number "
              "of samples: %i." % (folds, n_samples)
          )
  
imports: from __future__ import division
  from numbers import Integral
  import warnings
label_desc: Use image node_id 1 for calling a global function with example usage: check_full_index(n_samples, folds, raise_on_exception) without return types