code: def make_custom_redirects(app, exception):
      """Make HTML redirects for miscellaneous pages."""
      if not _check_valid_builder(app, exception):
          return
  
      for _fr, _to in custom_redirects.items():
          fr = f"{_fr}.html"
          to = f"{_to}.html"
          fr_path = Path(app.outdir) / fr
          check_existing_redirect(fr_path)
          if to.startswith("http"):
              to_path = to
          else:
              to_path = Path(app.outdir) / to
              assert to_path.is_file(), to_path
          # recreate folders that no longer exist
          defunct_gallery_folders = (
              "misc",
              "discussions",
              "source-modeling",
              "sample-datasets",
              "connectivity",
          )
          parts = fr_path.relative_to(Path(app.outdir)).parts
          if (
              len(parts) > 1  # whats_new violates this
              and parts[1] in defunct_gallery_folders
              and not fr_path.parent.exists()
          ):
              os.makedirs(fr_path.parent, exist_ok=True)
          # write the redirect
          with open(fr_path, "w") as fid:
              fid.write(REDIRECT_TEMPLATE.format(to=to_path))
      sphinx_logger.info(
          f"Added {len(custom_redirects):3d} HTML custom redirects"
      )
  
imports: import faulthandler
  import gc
  import os
  import subprocess
  import sys
  import time
  import warnings
  from datetime import datetime, timezone
  from importlib.metadata import metadata
  from pathlib import Path
  import matplotlib
  import numpy
  import sphinx
  from numpydoc import docscrape
  from sphinx.domains.changeset import versionlabels
  from sphinx_gallery.sorting import ExplicitOrder, FileNameSortKey
  import mne
  import mne.html_templates._templates
  from mne.tests.test_docstring_parameters import error_ignores
  from mne.utils import _assert_no_instances, linkcode_resolve, run_subprocess, sizeof_fmt
  from mne.viz import Brain
label_desc: Use image node_id 7 for calling a global function with example usage: make_custom_redirects(app, exception) without return types