@staticmethod
def sorted_roles_to_dict(role_list_sorted, threshold=0.5):
    """ Converted sorted role-probability list into formatted dict

        This function ensures that the top role returned is Unknown
        if the top role has a probability less than the threshold
        specified in the default input parameter.

        INPUTS:
        --role_list_sorted: a sorted list that associates the top role
        with their probabilities
        --threshold: probability threshold below which the top role
        should be designated as "Unknown"

        OUTPUTS:
        --predictions: a dict with the top role and a sorted role list
        """
    top_role_prob = role_list_sorted[0][1]
    if top_role_prob <= threshold:
        top_role = 'Unknown'
    else:
        top_role = role_list_sorted[0][0]
    role_predictions = {'top_role': top_role, 'role_list': role_list_sorted}
    return role_predictions
