code: def _modify_str_or_docstring(str_change_func):
      @functools.wraps(str_change_func)
      def wrapper(func_or_str):
          if isinstance(func_or_str, string_types):
              func = None
              doc = func_or_str
          else:
              func = func_or_str
              doc = func.__doc__
  
          # PYTHONOPTIMIZE=2 strips docstrings, so they can disappear unexpectedly
          if doc is not None:
              doc = str_change_func(doc)
  
          if func:
              func.__doc__ = doc
              return func
          return doc
  
      return wrapper
  
file_path: catboost/contrib/python/ipython/py2/IPython/utils/py3compat.py
imports: import functools
  import os
  import sys
  import re
  import shutil
  import types
  import platform
  from .encoding import DEFAULT_ENCODING
label_desc: Use image node_id 7 for calling a global function with example usage: _modify_str_or_docstring(str_change_func) and returns: wrapper, doc, func