code: def _truncate_location(location):
      """
      Cuts off anything after the first colon in location strings.
  
      This allows for easy comparison even when line numbers change
      (as they do regularly).
      """
      return location.split(":", 1)[0]
  
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 4 for calling a global function with example usage: _truncate_location(location) and returns: location