code: def record_missing_reference_handler(app, env, node, contnode):
      """
      When the sphinx app notices a missing reference, it emits an
      event which calls this function. This function records the missing
      references for analysis at the end of the sphinx build.
      """
      if not app.config.missing_references_enabled:
          # no-op when we are disabled.
          return
  
      if not hasattr(env, "missing_references_events"):
          env.missing_references_events = defaultdict(set)
  
      record_missing_reference(app, env.missing_references_events, node)
  
imports: from collections import defaultdict
  import json
  import logging
  from pathlib import Path
  from docutils.utils import get_source_line
  from docutils import nodes
  from sphinx.util import logging
  import matplotlib
label_desc: Use image node_id 2 for calling a global function with example usage: record_missing_reference_handler(app, env, node, contnode) without return types