def get_read_id_with_better_base_qual(r1_entry, r2_entry,
    base_index_in_read_1, base_index_in_reversed_read_2, min_qual_score):
    """
    When there is a disagreement regarding a base between pairs at the overlapped region,
    such as this one:

    read 1: AAAAAAAAAAAAAAAAAAAAAAAAAAAA
    read 2:                AAAATAAAAAAAAAAAAAAAAAAAAAAAA
                               ^

    there can be two outcomes for the merged sequence:
    We would either use the base in read 1,
    in which case the merged sequence would look like this:

    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
                       ^

    or we would use the base in read 2 that would result with this one:

    AAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAA
                       ^


    This function takes both reads and returns the read id (1 or 2)
    that has a higher quality score assigned by the sequencer for the base in question.
    If the higher quality score is still lower than min_qual_score parameter,
    0 is returned as read id.
    """
    if not r1_entry.Q_list:
        r1_entry.process_Q_list()
        r2_entry.process_Q_list()
    base_qual_in_read_1 = r1_entry.Q_list[base_index_in_read_1]
    base_qual_in_read_2 = r2_entry.Q_list[::-1][base_index_in_reversed_read_2]
    if max([base_qual_in_read_1, base_qual_in_read_2]) < min_qual_score:
        return 0
    if base_qual_in_read_1 >= base_qual_in_read_2:
        return 1
    else:
        return 2
