'Run \'func\' under os sandboxing'

def run(self, func):

    try:
        self._copy(self)
        if _file:
            builtins.file = self._file
        builtins.open = self._open
        self._active = True
        return func()
    finally:
        self._active = False
        if _file:
            builtins.file = _file
        builtins.open = _open
        self._copy(_os)
