def __exit__(self, extype, ex, tb):
    try:
        if (extype is not None):
            self._rollback()
        else:
            self._commit()
    finally:
        self._managed = False
def __exit__(self, extype, ex, tb):
    try:
        if (extype is not None):
            self._rollback()
        else:
            self._commit()
    finally:
        self._managed = False