def register_exit(self, exit):
        """Accepts callbacks with the same signature as context manager __exit__ methods

           Can also suppress exceptions the same way __exit__ methods can.
        """
        self._callbacks.append(exit)
        return exit # Allow use as a decorator
Accepts callbacks with the same signature as context manager __exit__ methods

           Can also suppress exceptions the same way __exit__ methods can.
        
recipes/Python/577981_CleanupManager/recipe-577981.py