'Check if this match should be accepted when ending or starting a hole.
:param match:
:type match:
:param to_keep:
:type to_keep: list[Match]
:param matches:
:type matches: Matches
:param hole: the filepart match
:type hole: Match
:param hole: the hole match
:type hole: Match
:param starting: true if match is starting the hole
:type starting: bool
:return:
:rtype:'

def should_keep(self, match, to_keep, matches, filepart, hole, starting):

    if (match.name in ['language', 'country']):
        if (len(hole.value) == len(match.raw)):
            return True
        outside_matches = filepart.crop(hole)
        other_languages = []
        for outside in outside_matches:
            other_languages.extend(matches.range(outside.start, outside.end, (lambda c_match: ((c_match.name == match.name) and (c_match not in to_keep)))))
        if (not other_languages):
            return True
    return False
