@contextlib.contextmanager
    def _session(self, savepoint=False):
        if self.session == None:
            self.session = self.factory._create_session(
                bind=self.connection, mode=self.mode)
            try:
                self.session.begin()
                yield self.session
                self._end_session_transaction(self.session)
            except Exception:
                self.session.rollback()
                # TODO(zzzeek) do we need save_and_reraise() here,
                # or do newer eventlets not have issues?  we are using
                # raw "raise" in many other places in oslo.db already
                # (and one six.reraise()).
                raise
            finally:
                self.session.close()
                self.session = None
        else:
            # use existing session, which is outer to us
            if savepoint:
                with self.session.begin_nested():
                    yield self.session
            else:
                yield self.session
dataset/ETHPy150Open openstack/oslo.db/oslo_db/sqlalchemy/enginefacade.py/_TransactionContext._session/operator `is` -> `==`