code: async def begin_twophase(self, xid=None):
          
  
          if self._transaction is not None:
              raise exc.InvalidRequestError(
                  "Cannot start a two phase transaction when a transaction "
                  "is already in progress.")
          if xid is None:
              xid = self._dialect.create_xid()
          self._transaction = TwoPhaseTransaction(self, xid)
          await self.execute("XA START %s", xid)
          return self._transaction
docs: Begin a two-phase or XA transaction and return a transaction
          handle.
  
          The returned object is an instance of
          TwoPhaseTransaction, which in addition to the
          methods provided by Transaction, also provides a
          TwoPhaseTransaction.prepare() method.
  
          xid - the two phase transaction id.  If not supplied, a
          random id will be generated.