docs: def set_transaction(self, session, transaction):
          # type: (Session, RepositoryTransaction) -> None
          """
          :param:session: :class:`sqlalchemy.orm.session.Session` instance
          :param:transaction: :class:`RepositoryTransaction` instance
          """
          if isinstance(session, sa.orm.scoped_session):
              session = session()
  
          s_id = id(session)
          self.transactions[s_id] = (weakref.ref(session), transaction)