code: def wrap_mangling_directive(base_directive, objtype):
      class directive(base_directive):
          def run(self):
              env = self.state.document.settings.env
  
              name = None
              if self.arguments:
                  m = re.match(
                      r"^(.*\s+)?(.*?)(\(.*)?", self.arguments[0]
                  )
                  name = m.group(2).strip()
  
              if not name:
                  name = self.arguments[0]
  
              lines = list(self.content)
              mangle_docstrings(
                  env.app, objtype, name, None, None, lines
              )
              self.content = ViewList(lines, self.content.parent)
  
              return base_directive.run(self)
  
      return directive
  
imports: import sys
  import re
  import pydoc
  import sphinx
  import inspect
  import collections
  from .docscrape_sphinx import get_doc_object, SphinxDocString
  from sphinx.util.compat import Directive
  from docutils.statemachine import ViewList
  from sphinx.domains.c import CDomain
  from sphinx.domains.python import PythonDomain
label_desc: Use image node_id 4 for calling a global function with example usage: wrap_mangling_directive(base_directive, objtype) and returns: directive, base_directive