code: def if_delegate_has_method(attr):
      """Compat method to replace `sklearn.utils.metaestimators.if_delegate_has`
  
      Older versions (< 1.0.0) of sklearn support it, but newer versions use
      `available_if` instead.
  
      References
      ----------
      .. [1] https://git.io/JzKiv
      .. [2] https://git.io/JzKiJ
      """
      if Version(sklearn.__version__) < Version("1.0.0"):
          from sklearn.utils.metaestimators import (
              if_delegate_has_method,
          )
  
          return if_delegate_has_method(attr)
      else:
          from sklearn.utils.metaestimators import available_if
  
          return available_if(_estimator_has(attr))
  
imports: from packaging.version import Version
  import sklearn
  from sklearn.exceptions import NotFittedError
label_desc: Use image node_id 4 for calling a global function with example usage: if_delegate_has_method(attr) and returns: if_delegate_has_method, available_if