interpreter pattern print"calculated cost{}\ndiscount applied{}\ {}discount appliedformattab calculate_cost()tab calculate_discount() tab calculate_discount(tab calculate_cost(now that we have single rule workingusing objects that result in some form of readable codelet' return to the implementation of the dsl using the composite pattern conditions can be set of conjuncted conditionsa set of disjuncted conditionsor single boolean expression class andconditions(object)def __init__(self)self conditions [def evaluate(selftab)return all( evaluate(tabfor in self conditionsdef add(selfcondition)self conditions append(conditiondef remove(selfcondition)self conditions remove(conditionclass orconditions(object)def __init__(self)self conditions [def evaluate(selftab)return any( evaluate(tabfor in self conditionsdef add(selfcondition)self conditions append(conditiondef remove(selfcondition)self conditions remove(condition