code: def _check_estimator(estimator, get_params=True):
      """Check whether an object has the methods required by sklearn."""
      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."
          )
  
imports: import datetime
  import numbers
  import numpy
  from ..fixes import BaseEstimator, _check_fit_params, _get_check_scoring
  from ..parallel import parallel_func
  from ..utils import verbose, warn
label_desc: Use image node_id 2 for calling a global function with example usage: _check_estimator(estimator, get_params) without return types