def METHOD_NAME(self, cm, cm_exit):
    """Helper to correctly register callbacks to __exit__ methods"""
    def _exit_wrapper(*exc_details):
        return cm_exit(cm, *exc_details)
    self.push(_exit_wrapper)