def __cleanup(self, _sys=sys, _shutdown_module=_shutdown_module):
        # The default parameters are necessary because this can be fired
        # from the destructor and so late when the interpreter shuts down
        # that these functions and modules might be gone.
        if self.mod is None:
            return
        modname = self.mod.__name__
        self.mod.__pluginbase_state__ = None
        self.mod = None
        try:
            delattr(_internalspace, self.spaceid)
        except __HOLE__:
            pass
        prefix = modname + '.'
        _sys.modules.pop(modname)
        for key, value in list(_sys.modules.items()):
            if not key.startswith(prefix):
                continue
            mod = _sys.modules.pop(key, None)
            if mod is None:
                continue
            _shutdown_module(mod)
dataset/ETHPy150Open dragondjf/PFramer/util/pluginbase.py/PluginSource.__cleanup