code: def _estimator_has(attr):
      """Checks if the model has a given attribute.
  
      Meant to be used along with `sklearn.utils.metaestimators.available_if`
  
      Parameters
      ----------
      attr : str
          The attribute to check the calling object for
  
      Returns
      -------
      fn : callable
          A function that will either raise an `AttributeError` if the attribute
          does not exist, or True if it does.
      """
  
      def check(self):
          # raise original `AttributeError` if `attr` does not exist
          getattr(self, attr)
          return True
  
      return check
  
imports: from packaging.version import Version
  import sklearn
  from sklearn.exceptions import NotFittedError
label_desc: Use image node_id 3 for calling a global function with example usage: _estimator_has(attr) and returns: check, True