code: def do_transaction(self, function, *args, **kwargs):
          
          with self.config.db_transaction() as trans:
              function(trans, *args, **kwargs)
docs: execute a function within the context of a transaction