def filter_features(features, key, include=None, exclude=None):
    """Filter an iterable of GeoJSON-like features based on
    one of their attributes.

    Parameters
    ----------
    features : iterable of dict
        Source GeoJSON-like features.
    key : str
        Property key.
    include : tuple of str, optional
        Property values to include.
    exclude : tuple of str, optional
        Property values to exclude.

    Returns
    -------
    out_features : list of dict
        Filtered GeoJSON-like features.
    """
    if not include and not exclude:
        raise ValueError('No value to include or exclude.')
    out_features = []
    for feature in features:
        if include:
            if feature['properties'][key] in include:
                out_features.append(feature)
        if exclude:
            if not feature['properties'][key] in exclude:
                out_features.append(feature)
    return out_features