def run_in_transaction(fn, *args, **kwargs):
 return ndb.transaction((lambda : fn(*args, **kwargs)), xg=True, propagation=ndb.TransactionOptions.ALLOWED)

def run_in_transaction ( fn , * args , ** kwargs ) : return ndb . transaction ( ( lambda : fn ( * args , ** kwargs ) ) , xg = True , propagation = ndb . TransactionOptions . ALLOWED )
runs a function in a transaction .