interpreter pattern def add_percentage_discount(selfitem_typepercent)if item_type ="any item" lambda xtrue elsef lambda xx item_type =item_type items_to_discount [item for item in self tab items if (item)for item in items_to_discountdiscount discount(item cost (percent/ )self discounts append(discountdef apply(self)if all(self conditions)return sum( amount for in self discountsreturn if __name__ ="__main__"member customertype("member"member_customer customer(member"john"tab tab(member_customerpizza itemtype("pizza"burger itemtype("burger"drink itemtype("drink"tab items append(item("margarita"pizza )tab items append(item("cheddar melt"burger )tab items append(item("latte"drink )rule rule(tabrule add_condition(tab customer is_a(member)rule add_percentage_discount("any item" tab discounts appendrule apply(