code: def normalize_intersphinx_mapping(
      app: Sphinx, config: Config
  ) -> None:
      for key, value in config.intersphinx_mapping.copy().items():
          try:
              if isinstance(value, (list, tuple)):
                  # new format
                  name, (uri, inv) = key, value
                  if not isinstance(name, str):
                      logger.warning(
                          __(
                              "intersphinx identifier %r is not string. Ignored"
                          ),
                          name,
                      )
                      config.intersphinx_mapping.pop(key)
                      continue
              else:
                  # old format, no name
                  # xref RemovedInSphinx80Warning
                  name, uri, inv = None, key, value
                  msg = (
                      "The pre-Sphinx 1.0 'intersphinx_mapping' format is "
                      "deprecated and will be removed in Sphinx 8. Update to the "
                      "current format as described in the documentation. "
                      f"Hint: \"intersphinx_mapping = {{'<name>': {(uri, inv)!r}}}\"."
                      "https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#confval-intersphinx_mapping"  # NoQA: E501
                  )
                  logger.warning(msg)
  
              if not isinstance(inv, tuple):
                  config.intersphinx_mapping[key] = (
                      name,
                      (uri, (inv,)),
                  )
              else:
                  config.intersphinx_mapping[key] = (name, (uri, inv))
          except Exception as exc:
              logger.warning(
                  __(
                      "Failed to read intersphinx_mapping[%s], ignored: %r"
                  ),
                  key,
                  exc,
              )
              config.intersphinx_mapping.pop(key)
  
imports: from __future__ import annotations
  import concurrent.futures
  import functools
  import posixpath
  import re
  import sys
  import time
  from os import path
  from typing import TYPE_CHECKING, cast
  from urllib.parse import urlsplit, urlunsplit
  from docutils import nodes
  from docutils.utils import relative_path
  import sphinx
  from sphinx.addnodes import pending_xref
  from sphinx.builders.html import INVENTORY_FILENAME
  from sphinx.errors import ExtensionError
  from sphinx.locale import _, __
  from sphinx.transforms.post_transforms import ReferencesResolver
  from sphinx.util import logging, requests
  from sphinx.util.docutils import CustomReSTDispatcher, SphinxRole
  from sphinx.util.inventory import InventoryFile
label_desc: Use image node_id 17 for calling a global function with example usage: normalize_intersphinx_mapping(app, config) without return types