code: def rollback_sysmodules() -> (
      Generator[None, None, None]
  ):  # NoQA: PT004
      """
      Rollback sys.modules to its value before testing to unload modules
      during tests.
  
      For example, used in test_ext_autosummary.py to permit unloading the
      target module to clear its cache.
      """
      try:
          sysmodules = list(sys.modules)
          yield
      finally:
          for modname in list(sys.modules):
              if modname not in sysmodules:
                  sys.modules.pop(modname)
  
imports: from __future__ import annotations
  import shutil
  import subprocess
  import sys
  from collections import namedtuple
  from io import StringIO
  from typing import TYPE_CHECKING, Any, Callable
  import pytest
  from sphinx.testing.util import SphinxTestApp, SphinxTestAppWrapperForSkipBuilding
label_desc: Use image node_id 13 for calling a global function with example usage: rollback_sysmodules() without return types