'Return a new cursor for the database. The cursor itself may be used
as a context manager to commit/rollback and close automatically.'

def cursor(self):

    cr = self.test_cr
    if (cr is not None):
        cr.acquire()
        return cr
    return self._db.cursor()
