def _save_and_block_module(name, orig_modules):
 saved = True
 try:
  orig_modules[name] = sys.modules[name]
 except KeyError:
  saved = False
 sys.modules[name] = None
 return saved

def _save_and_block_module ( name , orig_modules ) : saved = True try : orig_modules [ name ] = sys . modules [ name ] except KeyError : saved = False sys . modules [ name ] = None return saved
helper function to save and block a module in sys .