code: def _pre_commit(self, transaction, *args, **kwargs):
          
          # Force the ``transaction`` to be not "in progress".
          transaction._clean_up()
          transaction._begin(retry_id=self.retry_id)
  
          # Update the stored transaction IDs.
          self.current_id = transaction._id
          if self.retry_id is None:
              self.retry_id = self.current_id
          try:
              return self.to_wrap(transaction, *args, **kwargs)
          except:  # noqa
              # NOTE: If ``rollback`` fails this will lose the information
              #       from the original failure.
              transaction._rollback()
              raise
docs: Begin transaction and call the wrapped callable.
  
          If the callable raises an exception, the transaction will be rolled
          back. If not, the transaction will be "ready" for ``Commit`` (i.e.
          it will have staged writes).
  
          Args:
              transaction (~.firestore_v1beta1.transaction.Transaction): A
                  transaction to execute the callable within.
              args (Tuple[Any, ...]): The extra positional arguments to pass
                  along to the wrapped callable.
              kwargs (Dict[str, Any]): The extra keyword arguments to pass
                  along to the wrapped callable.
  
          Returns:
              Any: result of the wrapped callable.
  
          Raises:
              Exception: Any failure caused by ``to_wrap``.