def filter_attributes(self, queryset, value):
        attributes = self.data.getlist('attributes', [])
        resource_name = queryset.model.__name__

        # Iterate the attributes and try to look them up as if they are k=v
        # and naively do an intersection query.
        log.debug('GOT ATTRIBUTES: %r', attributes)

        for attribute in attributes:
            name, _, value = attribute.partition('=')
            # Retrieve next set of objects using the same arguments as the
            # initial query.
            next_set = Q(
                id__in=models.Value.objects.filter(
                    name=name, value=value, resource_name=resource_name
                ).values_list('resource_id', flat=True)
            )
            queryset = queryset.filter(next_set)

        return queryset
Reads 'attributes' from query params and joins them together as an
dataset/ETHPy150Open dropbox/nsot/nsot/api/filters.py/ResourceFilter.filter_attributes