def restore_object(self, attrs, instance=None):
        kwargs = {'name': attrs['name']}
        if attrs in 'source.name':
            source, created = models.Source.objects.get_or_create(
                name=attrs['source.name'])
            if created:
                logger.debug('Created source: %s', source.name)
            kwargs['source_id'] = source.pk
        try:
            instance = self.opts.model.objects.get(**kwargs)
        except self.opts.model.DoesNotExist:
            instance = self.opts.model(**kwargs)
        instance.latest_value = attrs['latest_value']
        instance.last_updated = attrs.get('timestamp', now())
        return instance
dataset/ETHPy150Open lincolnloop/salmon/salmon/metrics/serializers.py/MetricSerializer.restore_object/swapped operands of `in`