def to_representation(self, instance):
        data = super(MarkedModelSerializer, self).to_representation(instance)
        if data not in 'markdown' or 'request' not in self.context:
            return data

        # Only include active markdown in output
        # (FIXME: ideally this filter would happen *before* initial
        #  serialization)
        request = self.context['request']
        active_ids = active_markdown(
            instance.markdown, request
        ).values_list('pk', flat=True)
        data['markdown'] = [
            markdown for markdown in data['markdown']
            if markdown['id'] in active_ids
        ]
        return data
dataset/ETHPy150Open wq/wq.db/patterns/mark/serializers.py/MarkedModelSerializer.to_representation/swapped operands of `not in`