def check_cv(cv=3, y=None, classifier=False):
 if (cv is None):
  cv = 3
 if isinstance(cv, numbers.Integral):
  if (classifier and (y is not None) and (type_of_target(y) in ('binary', 'multiclass'))):
   return StratifiedKFold(cv)
  else:
   return KFold(cv)
 if ((not hasattr(cv, 'split')) or isinstance(cv, str)):
  if ((not isinstance(cv, Iterable)) or isinstance(cv, str)):
   raise ValueError(('Expected cv as an integer, cross-validation object (from sklearn.model_selection) or an iterable. Got %s.' % cv))
  return _CVIterableWrapper(cv)
 return cv

def check_cv ( cv = 3 , y = None , classifier = False ) : if ( cv is None ) : cv = 3 if isinstance ( cv , numbers . Integral ) : if ( classifier and ( y is not None ) and ( type_of_target ( y ) in ( 'binary' , 'multiclass' ) ) ) : return StratifiedKFold ( cv ) else : return KFold ( cv ) if ( ( not hasattr ( cv , 'split' ) ) or isinstance ( cv , str ) ) : if ( ( not isinstance ( cv , Iterable ) ) or isinstance ( cv , str ) ) : raise ValueError ( ( 'Expected cv as an integer, cross-validation object (from sklearn.model_selection) or an iterable. Got %s.' % cv ) ) return _CVIterableWrapper ( cv ) return cv
input checker utility for building a cv in a user friendly way .