code: async def begin_nested(self):
          
          if self._transaction is None:
              self._transaction = RootTransaction(self)
              await self._begin_impl()
          else:
              self._transaction = NestedTransaction(self, self._transaction)
              self._transaction._savepoint = await self._savepoint_impl()
          return self._transaction
docs: Begin a nested transaction and return a transaction handle.
  
          The returned object is an instance of :class:`.NestedTransaction`.
  
          Nested transactions require SAVEPOINT support in the
          underlying database.  Any transaction in the hierarchy may
          .commit() and .rollback(), however the outermost transaction
          still controls the overall .commit() or .rollback() of the
          transaction of a whole.