code: def _warn_unused_missing_references(app):
      if not app.config.missing_references_warn_unused_ignores:
          return
  
      # We can only warn if we are building from a source install
      # otherwise, we just have to skip this step.
      basepath = Path(
          matplotlib.__file__
      ).parent.parent.parent.resolve()
      srcpath = Path(app.srcdir).parent.resolve()
  
      if basepath != srcpath:
          return
  
      # This is a dictionary of {(domain_type, target): locations}
      references_ignored = getattr(
          app.env, "missing_references_ignored_references", {}
      )
      references_events = getattr(
          app.env, "missing_references_events", {}
      )
  
      # Warn about any reference which is no longer missing.
      for (
          domain_type,
          target,
      ), locations in references_ignored.items():
          missing_reference_locations = [
              _truncate_location(location)
              for location in references_events.get(
                  (domain_type, target), []
              )
          ]
  
          # For each ignored reference location, ensure a missing reference
          # was observed. If it wasn't observed, issue a warning.
          for ignored_reference_location in locations:
              short_location = _truncate_location(
                  ignored_reference_location
              )
              if short_location not in missing_reference_locations:
                  msg = (
                      f"Reference {domain_type} {target} for "
                      f"{ignored_reference_location} can be removed"
                      f" from {app.config.missing_references_filename}."
                      " It is no longer a missing reference in the docs."
                  )
                  logger.warning(
                      msg,
                      location=ignored_reference_location,
                      type="ref",
                      subtype=domain_type,
                  )
  
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 5 for calling a global function with example usage: _warn_unused_missing_references(app) without return types