def get_available_username(user_profile):
    """
    Determines the username based on information available from slack.
    First information is used in the following order:
    1) display_name, 2) real_name

    :param user_profile: Slack user_profile dict
    :return: human-readable username
    """

    display_name = user_profile["display_name_normalized"]
    if display_name:
        return display_name

    real_name = user_profile["real_name_normalized"]
    if real_name:
        return real_name

    raise ValueError("User Profile data missing name information")