def METHOD_NAME(cls, username, new_username, _test=False):
    oldb = get_db()
    t = oldb.transaction()
    try:
        rows_changed = oldb.update(
            cls.TABLENAME,
            where="username=$username",
            username=new_username,
            vars={"username": username},
        )
    except (UniqueViolation, IntegrityError):
        # if any of the records would conflict with an exiting
        # record associated with new_username
        pass  # assuming impossible for now, not a great assumption
    t.rollback() if _test else t.commit()
    return rows_changed