def cal_accuracy_on_2(sample_label_prob_dict_list, test_label_list):
    """
    :param
        sample_label_prob_dict_list:
            [
                {1: 0.2, 2:0.15, 3:0.2, ..., 9:0.1}
                {1: 0.2, 2:0.15, 3:0.2, ..., 9:0.1}
                ...
            ]
        test_label_list:
            [1,2,5,6,8, ...]
    :return:
        accuracy of the first two predictions
    """
    test_correct_count = 0
    for label_prob_dict, label in zip(sample_label_prob_dict_list, test_label_list):
        first_2_max_prob_k_v_pair = sorted(label_prob_dict.items(), key=lambda k_v_pair: k_v_pair[1], reverse=True)[:2]
        key1 = first_2_max_prob_k_v_pair[0][0]
        key2 = first_2_max_prob_k_v_pair[1][0]

        if (key1 == label) or (key2 == label):
            test_correct_count += 1

    acc_on_2 = test_correct_count / len(test_label_list)
    return acc_on_2