def validate_products(self, value):
        for product in value:
            if 'id' not in product or 'qty' not in product:
                raise serializers.ValidationError(
                    'Each product must contain "id" and "qty".'
                )
            product_obj = shop_api.get_product(product['id'])
            if product_obj is None:
                raise serializers.ValidationError(
                    'Product with id "{}" not found.'.format(product['id'])
                )
            if product['qty'] <= 0:
                raise serializers.ValidationError(
                    'Product quantity must be greater than 0.'
                )
        return value
dataset/ETHPy150Open uppsaladatavetare/foobar-api/src/foobar/rest/serializers/purchase.py/PurchaseRequestSerializer.validate_products/original