code: def save_modules():
      """
      Context in which imported modules are saved.
  
      Translates exceptions internal to the context into the equivalent exception
      outside the context.
      """
      saved = sys.modules.copy()
      with ExceptionSaver() as saved_exc:
          yield saved
  
      sys.modules.update(saved)
      # remove any modules imported since
      del_modules = (
          mod_name
          for mod_name in sys.modules
          if mod_name not in saved
          # exclude any encodings modules. See #285
          and not mod_name.startswith("encodings.")
      )
      _clear_modules(del_modules)
  
      saved_exc.resume()
  
imports: import os
  import sys
  import tempfile
  import operator
  import functools
  import itertools
  import re
  import contextlib
  import pickle
  import textwrap
  from setuptools.extern import six
  from setuptools.extern.six.moves import builtins, map
  import pkg_resources.py31compat
  from distutils.errors import DistutilsError
  from pkg_resources import working_set
label_desc: Use image node_id 6 for calling a global function with example usage: save_modules() without return types