<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def list_items(self, sort_key=None, reverse=False):
 """Return a list of cart items. Parameters sort_key : func A function to customize the list order, same as the 'key' argument to the built-in :func:`sorted`. reverse: bool If set to True, the sort order will be reversed. Returns ------- list List of :attr:`item_class` instances. Examples -------- [<CartItem: obj=bar, quantity=3>, <CartItem: obj=foo, quantity=1>, <CartItem: obj=nox, quantity=5>] [<CartItem: obj=nox, quantity=5>, <CartItem: obj=bar, quantity=3>, <CartItem: obj=foo, quantity=1>] """

        items = list(self.items.values())
        if sort_key:
            items.sort(key=sort_key, reverse=reverse)
        return items