code: def get_real_func(obj):
      """Get the real function object of the (possibly) wrapped object by
      functools.wraps or functools.partial."""
      start_obj = obj
      for i in range(100):
          # __pytest_wrapped__ is set by @pytest.fixture when wrapping the fixture function
          # to trigger a warning if it gets called directly instead of by pytest: we don't
          # want to unwrap further than this otherwise we lose useful wrappings like @mock.patch (#3774)
          new_obj = getattr(obj, "__pytest_wrapped__", None)
          if isinstance(new_obj, _PytestWrapper):
              obj = new_obj.obj
              break
          new_obj = getattr(obj, "__wrapped__", None)
          if new_obj is None:
              break
          obj = new_obj
      else:
          from _pytest._io.saferepr import saferepr
  
          raise ValueError(
              (
                  "could not find real function of {start}\nstopped at {current}"
              ).format(start=saferepr(start_obj), current=saferepr(obj))
          )
      if isinstance(obj, functools.partial):
          obj = obj.func
      return obj
  
imports: from __future__ import annotations
  import dataclasses
  import enum
  import functools
  import inspect
  import os
  import sys
  from inspect import Parameter
  from inspect import signature
  from pathlib import Path
  from typing import Any
  from typing import Callable
  from typing import Generic
  from typing import NoReturn
  from typing import TYPE_CHECKING
  from typing import TypeVar
  import _pytest._py.path
label_desc: Use image node_id 13 for calling a global function with example usage: get_real_func(obj) and returns: obj