'Return the django-filters `FilterSet` used to filter the queryset.'

def get_filter_class(self, view, queryset=None):

    filter_class = getattr(view, 'filter_class', None)
    filter_fields = getattr(view, 'filter_fields', None)
    if filter_class:
        filter_model = filter_class.Meta.model
        assert issubclass(queryset.model, filter_model), ('FilterSet    model    %s    does    not    match    queryset    model    %s' % (filter_model, queryset.model))
        return filter_class
    if filter_fields:
        MetaBase = getattr(self.default_filter_set, 'Meta', object)
        class AutoFilterSet(self.default_filter_set, ):
            class Meta(MetaBase, ):
                model = queryset.model
                fields = filter_fields
        return AutoFilterSet
    return None
