def filter_metadata(self, queryset, value):
        try:
            value = json.loads(value)
        except __HOLE__:
            raise GenericAPIException(400, 'metadata must be valid JSON.')

        for name, values in value.items():
            if not isinstance(values, list):
                values = [values]
            query = Q()
            for v in values:
                if v is None:
                    query = query | ~Q(metadata_set__name=name)
                else:
                    query = query | Q(metadata_set__name=name, metadata_set__value=v)
            queryset = queryset.filter(query)

        return queryset
dataset/ETHPy150Open mozilla/kitsune/kitsune/questions/api.py/QuestionFilter.filter_metadata