code: func runTxn(c context.Context, cb func(context.Context) error) error {
  	var attempt int
  	var innerErr error
  
  	err := datastore.RunInTransaction(c, func(c context.Context) error {
  		attempt++
  		if attempt != 1 {
  			if innerErr != nil {
  				logging.Warningf(c, "Retrying the transaction after the error: %s", innerErr)
  			} else {
  				logging.Warningf(c, "Retrying the transaction: failed to commit")
  			}
  		}
  		innerErr = cb(c)
  		if transient.Tag.In(innerErr) && !abortTransaction.In(innerErr) {
  			return datastore.ErrConcurrentTransaction // causes a retry
  		}
  		return innerErr
  	}, &defaultTransactionOptions)
  
  	if err != nil {
  		logging.WithError(err).Errorf(c, "Transaction failed")
  		if innerErr != nil {
  			return innerErr
  		}
  		// Here it can only be a commit error (i.e. produced by RunInTransaction
  		// itself, not by its callback). We treat them as transient.
  		return transient.Tag.Apply(err)
  	}
  
  	return nil
  }
docs: // runTxn runs a datastore transaction retrying the body on transient errors or
  // when encountering a commit conflict.
  //
  // It will NOT retry errors (even if transient) marked with abortTransaction
  // tag. This is primarily used to tag errors that are transient at a level
  // higher than the transaction: errors marked with both transient.Tag and
  // abortTransaction are not retried by runTxn, but may be retried by something
  // on top (like Task Queue).