'Clean up sys.modules after the session is destroyed.'

def delete_modules(self):

    for module in self._modules:
        if (module.__name__ in sys.modules):
            del sys.modules[module.__name__]
