def enter_context(self, cm):
        """Accepts and automatically enters other context managers"""
        # We look up the special methods on the type to match the with statement
        _cm_type = type(cm)
        _exit = _cm_type.__exit__
        result = _cm_type.__enter__(cm)
        def _exit_wrapper(*exc_details):
            return _exit(cm, *exc_details)
        self.register_exit(_exit_wrapper)
        return result
Accepts and automatically enters other context managers
recipes/Python/577981_CleanupManager/recipe-577981.py