code: def patch_func(replacement, target_mod, func_name):
      """
      Patch func_name in target_mod with replacement
  
      Important - original must be resolved by name to avoid
      patching an already patched function.
      """
      original = getattr(target_mod, func_name)
  
      # set the 'unpatched' attribute on the replacement to
      # point to the original.
      vars(replacement).setdefault("unpatched", original)
  
      # replace the function in the original module
      setattr(target_mod, func_name, replacement)
  
file_path: catboost/contrib/python/setuptools/py2/setuptools/monkey.py
imports: import sys
  import distutils.filelist
  import platform
  import types
  import functools
  from importlib import import_module
  import inspect
  from setuptools.extern import six
  import setuptools
label_desc: Use image node_id 6 for calling a global function with example usage: patch_func(replacement, target_mod, func_name) without return types