design pattern quick reference composite composite py class leaf(object)def __init__(self*args**kwargs)pass def component_function(self)print("leaf"class composite(object)def __init__(self*args**kwargs)self children [def component_function(self)for child in childrenchild component_function(def add(selfchild)self children append(childdef remove(selfchild)self children remove(childinterpreter interpreter py class nonterminal(object)def __init__(selfexpression)self expression expression def interpret(self)self expression interpret(class terminal(object)def interpret(self)pass