def __exit__(self, exc_type, exc_value, traceback):
        """Hide all exposed attributes and any new variables"""
        if self._entries == 1:
            callers = {}
            for s in self._callers: callers.update(zip(s.keys(), [s] * len(s)))
            currentNames = set(callers.keys())
            savedNames = set()
            for s in self._backups: savedNames.update(s.keys())
            exposedNames = set(self.__dict__.keys())
            for n in exposedNames - currentNames:
                delattr(self, n)
            for n in currentNames - savedNames:
                s = callers[n]
                setattr(self, n, s[n])
                del s[n]
            for s, b in zip(self._callers, self._backups):
                s.update(b)
            del self._callers, self._backups
        self._entries -= 1
Hide all exposed attributes and any new variables
recipes/Python/577372_Attributes_local_variables_inside/recipe-577372.py