code: def make_refnode(
      builder: Builder,
      fromdocname: str,
      todocname: str,
      targetid: str | None,
      child: Node | list[Node],
      title: str | None = None,
  ) -> nodes.reference:
      """Shortcut to create a reference node."""
      node = nodes.reference("", "", internal=True)
      if fromdocname == todocname and targetid:
          node["refid"] = targetid
      else:
          if targetid:
              node["refuri"] = (
                  builder.get_relative_uri(fromdocname, todocname)
                  + "#"
                  + targetid
              )
          else:
              node["refuri"] = builder.get_relative_uri(
                  fromdocname, todocname
              )
      if title:
          node["reftitle"] = title
      node += child
      return node
  
imports: from __future__ import annotations
  import contextlib
  import re
  import unicodedata
  from typing import TYPE_CHECKING, Any, Callable
  from docutils import nodes
  from sphinx import addnodes
  from sphinx.locale import __
  from sphinx.util import logging
label_desc: Use image node_id 19 for calling a global function with example usage: make_refnode(builder, fromdocname, todocname, targetid, child, title) and returns: node