code: def my_import(name, path=None):
      
  
      # Documentation for importlib says this may be needed to pick up
      # modules created after the program has started
      if hasattr(importlib, 'invalidate_caches'):
          # python 3.3+
          importlib.invalidate_caches()
  
      if path is not None:
          directory, src_file = os.path.split(path)
  
          # TODO: use the importlib.util machinery
          sys.path.insert(0, directory)
          try:
              mod = importlib.import_module(name)
          finally:
              sys.path.pop(0)
  
      else:
          mod = importlib.import_module(name)
  
      return mod
docs: Return imported module for the given name.