code: def estimator_has(attr):
      def _check(self):
          if hasattr(self, "best_estimator_"):
              return hasattr(self.best_estimator_, attr)
          if hasattr(self, "estimator"):
              return hasattr(self.estimator, attr)
  
      return _check
  
imports: import copy
  import warnings
  from itertools import compress
  import dask
  import dask.array
  import dask.dataframe
  import numpy
  import packaging.version
  import scipy.sparse
  from dask.base import tokenize
  from dask.delayed import Delayed, delayed
  from sklearn.utils.validation import _is_arraylike, indexable
  from ..utils import _num_samples
label_desc: Use image node_id 7 for calling a global function with example usage: estimator_has(attr) and returns: _check, hasattr, hasattr