def apply_filters(matches, *filters):
    """
    Apply a sequence of `filters` to a `matches` iterable. Return a new filtered
    matches iterable.

    A filter must accept a single arg: an iterable of tuples of (key, match,
    line, lineno) and must return an iterable of tuples of (key, match, line,
    lineno).
    """
    for filt in filters:
        matches = filt(matches)
    return matches