def _check_estimator(estimator, get_params=True):
 valid_methods = ('predict', 'transform', 'predict_proba', 'decision_function')
 if ((not hasattr(estimator, 'fit')) or (not any((hasattr(estimator, method) for method in valid_methods)))):
  raise ValueError('estimator must be a scikit-learn transformer or an estimator with the fit and a predict-like (e.g. predict_proba) or a transform method.')
 if (get_params and (not hasattr(estimator, 'get_params'))):
  raise ValueError('estimator must be a scikit-learn transformer or an estimator with the get_params method that allows cloning.')

def _check_estimator ( estimator , get_params = True ) : valid_methods = ( 'predict' , 'transform' , 'predict_proba' , 'decision_function' ) if ( ( not hasattr ( estimator , 'fit' ) ) or ( not any ( ( hasattr ( estimator , method ) for method in valid_methods ) ) ) ) : raise ValueError ( 'estimator must be a scikit-learn transformer or an estimator with the fit and a predict-like (e.g. predict_proba) or a transform method.' ) if ( get_params and ( not hasattr ( estimator , 'get_params' ) ) ) : raise ValueError ( 'estimator must be a scikit-learn transformer or an estimator with the get_params method that allows cloning.' )
check whether an object has the methods required by sklearn .