Get an user by their username.

    :param str username: Username to find
    :return: the user
    :rtype: User object or None

def find_user_by_name(username):
    """Get an user by their username.

    :param str username: Username to find
    :return: the user
    :rtype: User object or None
    """
    if db is not None:
        uid = db.hget('users', username)
        if uid:
            return get_user(uid)
    else:
        for uid, u in app.config['COIL_USERS'].items():
            if u['username'] == username:
                return get_user(uid)