def get_sorted_key_index(class_key, class_dict):
    """
    Given class_dict, returns an index that would result from ordering the keys 
    in class_dict according to their values and accessing one of the keys (class_key).
    That index can be used to access multiclass prediction scores
    """
    assert(isinstance(class_key, str))
    keys_sorted = list(sorted(class_dict, key=class_dict.__getitem__, reverse=False))
    ix = [i for i, k in enumerate(keys_sorted) if k == class_key]
    if not len(ix):
        raise Exception("key not found in class_dict")
    return ix[0]