def longest_non_overlapping_matches(sorted_matches):
    """Return a generator of the longest non-overlapping matches from a sorted
    list of matches."""
    start = -1
    for match in sorted_matches:
        if match.start < start:
            continue
        yield match
        start = match.end
