def check_username(db, username):
    """
    Checks if given username exists in the database.

    :param username: username to check
    :return: True if username is in the database, False otherwise
    """

    if db(db.users.username == username).select():
        return True
    return False