code: def _wrap_method_output(f, method):
      """Wrapper used by `_SetOutputMixin` to automatically wrap methods."""
  
      @wraps(f)
      def wrapped(self, X, *args, **kwargs):
          data_to_wrap = f(self, X, *args, **kwargs)
          if isinstance(data_to_wrap, tuple):
              # only wrap the first output for cross decomposition
              return_tuple = (
                  _wrap_data_with_container(
                      method, data_to_wrap[0], X, self
                  ),
                  *data_to_wrap[1:],
              )
              # Support for namedtuples `_make` is a documented API for namedtuples:
              # https://docs.python.org/3/library/collections.html#collections.somenamedtuple._make
              if hasattr(type(data_to_wrap), "_make"):
                  return type(data_to_wrap)._make(return_tuple)
              return return_tuple
  
          return _wrap_data_with_container(
              method, data_to_wrap, X, self
          )
  
      return wrapped
  
file_path: catboost/contrib/python/scikit-learn/py3/sklearn/utils/_set_output.py
imports: from functools import wraps
  from scipy.sparse import issparse
  from .._config import get_config
  from .None import check_pandas_support
  from ._available_if import available_if
label_desc: Use image node_id 4 for calling a global function with example usage: _wrap_method_output(f, method) and returns: wrapped, _wrap_data_with_container, return_tuple, type