def restore_sys_module_state(self):
    'Restore the state of the sys module.'
    try:
        for (k, v) in self._orig_sys_module_state.items():
            setattr(sys, k, v)
    except AttributeError:
        pass
    if (self._orig_sys_modules_main_mod is not None):
        sys.modules[self._orig_sys_modules_main_name] = self._orig_sys_modules_main_mod
Restore the state of the sys module.
def restore_sys_module_state(self):
    
    try:
        for (k, v) in self._orig_sys_module_state.items():
            setattr(sys, k, v)
    except AttributeError:
        pass
    if (self._orig_sys_modules_main_mod is not None):
        sys.modules[self._orig_sys_modules_main_name] = self._orig_sys_modules_main_mod