code: def _callInTransaction(self, func, *args, **kwargs):
          
          # No nesting of transactions
          self.conn.rollback()
  
          try:
              self.cur = self.conn.cursor()
              try:
                  ret = func(*args, **kwargs)
              finally:
                  self.cur.close()
                  self.cur = None
          except:
              self.conn.rollback()
              raise
          else:
              self.conn.commit()
  
          return ret
docs: Execute the given function inside of a transaction, with an
          open cursor. If no exception is raised, the transaction is
          comitted, otherwise it is rolled back.