code: def if_delegate_has_method(delegate):
      """Create a decorator for methods that are delegated to a sub-estimator
  
      This enables ducktyping by hasattr returning True according to the
      sub-estimator.
  
      Parameters
      ----------
      delegate : string, list of strings or tuple of strings
          Name of the sub-estimator that can be accessed as an attribute of the
          base object. If a list or a tuple of names are provided, the first
          sub-estimator that is an attribute of the base object  will be used.
  
      """
      if isinstance(delegate, list):
          delegate = tuple(delegate)
      if not isinstance(delegate, tuple):
          delegate = (delegate,)
  
      return lambda fn: _IffHasAttrDescriptor(
          fn, delegate, attribute_name=fn.__name__
      )
  
file_path: catboost/contrib/python/scikit-learn/py2/sklearn/utils/metaestimators.py
imports: from operator import attrgetter
  from functools import update_wrapper
  import numpy
  from ..utils import safe_indexing
label_desc: Use image node_id 1 for calling a global function with example usage: if_delegate_has_method(delegate) and returns: function