code: def _check_method(estimator, method):
      """Check that an estimator has the method attribute.
  
      If method == 'transform'  and estimator does not have 'transform', use
      'predict' instead.
      """
      if method == "transform" and not hasattr(estimator, "transform"):
          method = "predict"
      if not hasattr(estimator, method):
          ValueError(
              "base_estimator does not have `%s` method." % method
          )
      return method
  
imports: import logging
  import numpy
  from ..fixes import _get_check_scoring
  from ..parallel import parallel_func
  from ..utils import ProgressBar, _parse_verbose, array_split_idx, fill_doc, verbose
  from .base import BaseEstimator, _check_estimator
  from .mixin import TransformerMixin
label_desc: Use image node_id 5 for calling a global function with example usage: _check_method(estimator, method) and returns: method