code: def ready_to_import(name=None, source=""):
      from test.support import script_helper
  
      # 1. Sets up a temporary directory and removes it afterwards
      # 2. Creates the module file
      # 3. Temporarily clears the module from sys.modules (if any)
      # 4. Reverts or removes the module when cleaning up
      name = name or "spam"
      with temp_dir() as tempdir:
          path = script_helper.make_script(tempdir, name, source)
          old_module = sys.modules.pop(name, None)
          try:
              sys.path.insert(0, tempdir)
              yield name, path
              sys.path.remove(tempdir)
          finally:
              if old_module is not None:
                  sys.modules[name] = old_module
              else:
                  sys.modules.pop(name, None)
  
imports: import contextlib
  import _imp
  import importlib
  import importlib.util
  import os
  import shutil
  import sys
  import unittest
  import warnings
  from .os_helper import unlink, temp_dir
label_desc: Use image node_id 13 for calling a global function with example usage: ready_to_import(name, source) without return types