code: def _toctree_self_entry(
      title: str,
      ref: str,
      titles: dict[str, nodes.title],
  ) -> nodes.bullet_list:
      # 'self' refers to the document from which this
      # toctree originates
      if not title:
          title = clean_astext(titles[ref])
      reference = nodes.reference(
          "",
          "",
          internal=True,
          refuri=ref,
          anchorname="",
          *[nodes.Text(title)],
      )
      para = addnodes.compact_paragraph("", "", reference)
      item = nodes.list_item("", para)
      # don't show subitems
      toc = nodes.bullet_list("", item)
      return toc
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Any, TypeVar
  from docutils import nodes
  from docutils.nodes import Element, Node
  from sphinx import addnodes
  from sphinx.locale import __
  from sphinx.util import logging, url_re
  from sphinx.util.matching import Matcher
  from sphinx.util.nodes import _only_node_keep_children, clean_astext
label_desc: Use image node_id 8 for calling a global function with example usage: _toctree_self_entry(title, ref, titles) and returns: toc