'Filter the queryset to all instances matching the given attributes.'

def filter_queryset(self, attrs, queryset):

    if (self.instance is not None):
        for field_name in self.fields:
            if (field_name not in attrs):
                attrs[field_name] = getattr(self.instance, field_name)
    filter_kwargs = {field_name: attrs[field_name] for field_name in self.fields}
    return qs_filter(queryset, **filter_kwargs)
