Converted probability of being treated to total percentage of clinical cases treated

def get_percentage_from_prob(prob):
    """
    Converted probability of being treated to total percentage of clinical cases treated
    """
    assert isinstance(prob, (float, int))
    prob = float(prob)
    assert prob >= 0
    assert prob <= 1

    percentages = list(probability_list.keys())
    percentages.sort()
    for percentage in percentages:
        if prob < probability_list[percentage]:
            return percentage - 1
    return 100