code: def _estimator_has(attr):
      """Check if we can delegate a method to the underlying estimator.
      First, we check the first fitted estimator if available, otherwise we
      check the estimator attribute.
      """
  
      def check(self):
          if hasattr(self, "estimators_"):
              return hasattr(self.estimators_[0], attr)
          elif self.estimator is not None:
              return hasattr(self.estimator, attr)
          else:  # TODO(1.4): Remove when the base_estimator deprecation cycle ends
              return hasattr(self.base_estimator, attr)
  
      return check
  
label_desc: Use image node_id 1 for calling a global function with example usage: _estimator_has(attr) and returns: check, hasattr, hasattr, hasattr