code: def _check_estimator(estimator):
      """Make sure that an estimator implements the necessary methods."""
      if not hasattr(estimator, "decision_function") and not hasattr(
          estimator, "predict_proba"
      ):
          raise ValueError(
              "The base estimator should implement "
              "decision_function or predict_proba!"
          )
  
imports: import array
  import numpy
  import warnings
  import scipy.sparse
  import itertools
  from .base import BaseEstimator, ClassifierMixin, clone, is_classifier
  from .base import MetaEstimatorMixin, is_regressor
  from .preprocessing import LabelBinarizer
  from .metrics.pairwise import euclidean_distances
  from .utils import check_random_state
  from .utils.validation import _num_samples
  from .utils.validation import check_is_fitted
  from .utils.validation import check_X_y
  from .utils.multiclass import _check_partial_fit_first_call, check_classification_targets, _ovr_decision_function
  from .utils.metaestimators import _safe_split
  from .externals.joblib import Parallel
  from .externals.joblib import delayed
  from .externals.six.moves import zip
label_desc: Use image node_id 4 for calling a global function with example usage: _check_estimator(estimator) without return types