code: def patch_import(ex_names):
      import builtins
  
      _import = copy.copy(builtins.__import__)
  
      def _monkey(name, *args, **kwargs):
          if name in ex_names:
              raise ImportError
          return _import(name, *args, **kwargs)
  
      def wrapper(fn):
          def wraps(*args, **kwargs):
              builtins.__import__ = _monkey
              from tslumen.report.dashboard import _dash
  
              _dash = importlib.reload(_dash)
              try:
                  return fn(_dash, *args, **kwargs)
              finally:
                  builtins.__import__ = _import
                  _dash = importlib.reload(_dash)
  
          return wraps
  
      return wrapper
  
file_path: tslumen/tests/unit/report/dashboard/test_base.py
imports: import pytest
  import importlib
  import copy
label_desc: Use image node_id 2 for calling a global function with example usage: patch_import(ex_names) and returns: wrapper, _import, wraps, fn