def is_valid_match(match, matches, filtered):
    valid = True
    ((start, end, kind, priority), _) = match
    for temp_match in matches:
        if temp_match in filtered or match == temp_match:
            continue
        ((temp_start, temp_end, temp_kind, temp_priority), _) = temp_match
        if start == temp_start and end == temp_end:
            if priority <= temp_priority:
                # More precise classification exists.
                valid = False
                break
        elif start >= temp_start and end <= temp_end:
            # Encapsulated in an existing match.
            valid = False
            break

    return valid
Returns true if the match is new, bigger than an existing match,
dataset/ETHPy150Open bartdag/recodoc2/recodoc2/apps/codeutil/parser.py/is_valid_match