def get_available_username(user_info):
    """
    Determines the username based on information available from slack.
    First information is used in the following order:
    1) display_name, 2) real_name, 3) name
    See: https://api.slack.com/types/user
    :param user_info: Slack user_info object
    :return: human-readable username
    """

    display_name = user_info["user"]["profile"]["display_name_normalized"]
    if display_name:
        return display_name

    real_name = user_info["user"]["profile"]["real_name_normalized"]
    if real_name:
        return real_name

    # real_name is required and should always be there
    # defaulting to name for safety
    return user_info["user"]["name"]