def is_purchase_permitted(self, quantity):
        if self.num_available <= 0:
            return False, _("no stock available")
        if quantity > self.num_available:
            msg = _("a maximum of %(max)d can be bought") % {
                'max': self.num_available}
            return False, msg
        return True, ""
dataset/ETHPy150Open django-oscar/django-oscar/src/oscar/apps/partner/availability.py/StockRequired.is_purchase_permitted/original