def change_quantity(self, pk, quantity):
pk = str(pk)<EOL>try:<EOL><INDENT>item = self.items[pk]<EOL><DEDENT>except KeyError:<EOL><INDENT>raise ItemNotInCart(pk=pk)<EOL><DEDENT>item.quantity = quantity<EOL>self.update()<EOL>
Change the quantity of an item.

        Parameters
        ----------
        pk : str or int
            The primary key of the item.
        quantity : int-convertible
            A new quantity.

        Raises
        ------
        ItemNotInCart
        NegativeItemQuantity
        NonConvertibleItemQuantity
        TooLargeItemQuantity
        ZeroItemQuantity