Get quantity of a single item in the basket

def item_count(self, request, variant_id=None):
        """
        Get quantity of a single item in the basket
        """
        bid = utils.basket_id(request)
        item = ProductVariant.objects.get(id=variant_id)
        try:
            count = BasketItem.objects.get(basket_id=bid, variant=item).quantity
        except BasketItem.DoesNotExist:
            count = 0
        return Response(data={"quantity": count}, status=status.HTTP_200_OK)