def _save_and_remove_module(name, orig_modules):
 if (name not in sys.modules):
  __import__(name)
  del sys.modules[name]
 for modname in list(sys.modules):
  if ((modname == name) or modname.startswith((name + '.'))):
   orig_modules[modname] = sys.modules[modname]
   del sys.modules[modname]

def _save_and_remove_module ( name , orig_modules ) : if ( name not in sys . modules ) : __import__ ( name ) del sys . modules [ name ] for modname in list ( sys . modules ) : if ( ( modname == name ) or modname . startswith ( ( name + '.' ) ) ) : orig_modules [ modname ] = sys . modules [ modname ] del sys . modules [ modname ]
helper function to save and remove a module from sys .