code: def _create_element_from_result(
      domain: Domain,
      inv_name: str | None,
      data: InventoryItem,
      node: pending_xref,
      contnode: TextElement,
  ) -> nodes.reference:
      proj, version, uri, dispname = data
      if "://" not in uri and node.get("refdoc"):
          # get correct path in case of subdirectories
          uri = posixpath.join(relative_path(node["refdoc"], "."), uri)
      if version:
          reftitle = _("(in %s v%s)") % (proj, version)
      else:
          reftitle = _("(in %s)") % (proj,)
      newnode = nodes.reference(
          "", "", internal=False, refuri=uri, reftitle=reftitle
      )
      if node.get("refexplicit"):
          # use whatever title was given
          newnode.append(contnode)
      elif dispname == "-" or (
          domain.name == "std" and node["reftype"] == "keyword"
      ):
          # use whatever title was given, but strip prefix
          title = contnode.astext()
          if inv_name is not None and title.startswith(inv_name + ":"):
              newnode.append(
                  contnode.__class__(
                      title[len(inv_name) + 1 :],
                      title[len(inv_name) + 1 :],
                  )
              )
          else:
              newnode.append(contnode)
      else:
          # else use the given display name (used for :ref:)
          newnode.append(contnode.__class__(dispname, dispname))
      return newnode
  
imports: from __future__ import annotations
  import concurrent.futures
  import functools
  import posixpath
  import re
  import sys
  import time
  from os import path
  from typing import TYPE_CHECKING, cast
  from urllib.parse import urlsplit, urlunsplit
  from docutils import nodes
  from docutils.utils import relative_path
  import sphinx
  from sphinx.addnodes import pending_xref
  from sphinx.builders.html import INVENTORY_FILENAME
  from sphinx.errors import ExtensionError
  from sphinx.locale import _, __
  from sphinx.transforms.post_transforms import ReferencesResolver
  from sphinx.util import logging, requests
  from sphinx.util.docutils import CustomReSTDispatcher, SphinxRole
  from sphinx.util.inventory import InventoryFile
label_desc: Use image node_id 7 for calling a global function with example usage: _create_element_from_result(domain, inv_name, data, node, contnode) and returns: newnode