code: def resolve_aliases(app, doctree):
      pending_xrefs = doctree.traverse(condition=pending_xref)
      for node in pending_xrefs:
          alias = node.get("reftarget", None)
          if alias is not None and alias in _reftarget_aliases:
              real_ref, text_to_render = _reftarget_aliases[alias]
              node["reftarget"] = real_ref
  
              text_node = next(
                  iter(node.traverse(lambda n: n.tagname == "#text"))
              )
              text_node.parent.replace(
                  text_node, Text(text_to_render, "")
              )
  
imports: import os
  import sys
  from docutils.nodes import Text
  from sphinx.addnodes import pending_xref
label_desc: Use image node_id 1 for calling a global function with example usage: resolve_aliases(app, doctree) without return types