code: def process_entity_nodes(app, doctree, docname):
      """Replace all the entities by their content"""
      env = app.builder.env
  
      entities = AllEntities.install(env)
      entities.resolve_pendings(app)
  
      language = None
      try:
          language = next(l for l in LANGUAGES if l in app.tags)
      except Exception:
          logger.warning(
              f"No language tag specified, not resolving entities in {docname}"
          )
  
      for node in doctree.traverse(EntityNode):
          if language is None:
              node.replace_self(
                  nodes.Text(_(node.entity), _(node.entity))
              )
          else:
              entity = entities.get(language, node.entity, docname)
              if entity is None:
                  node.replace_self(
                      nodes.Text(_(node.entity), _(node.entity))
                  )
                  logger.warning(
                      f'Entity "{node.entity}" has not been defined',
                      location=node,
                  )
              else:
                  node.replace_self(entity["content"])
  
imports: from collections import defaultdict, abc
  from typing import cast
  from docutils import nodes
  from docutils.parsers.rst import Directive
  import sphinx
  from sphinx.locale import _
  from sphinx.util.docutils import SphinxDirective
  from sphinx.errors import ExtensionError
  from conf import languages
label_desc: Use image node_id 3 for calling a global function with example usage: process_entity_nodes(app, doctree, docname) without return types