facade pattern it would not be hard to imagine an implementation of the process transaction that would work like thisimport datetime import random class invoice(object)def __init__(selfcustomer)self timestamp datetime datetime now(self number self generate_number(self lines [self total self tax self customer customer def save(self)save the invoice to some sort of persistent storage pass def send_to_printer(self)send invoice representation to external printer pass def add_line(selfinvoice_line)self lines append(invoice_lineself calculate(def remove_line(selfline_item)tryself lines remove(line_itemexcept valueerror as print("could not remove {because there is no such item in the invoiceformat(line_item)def calculate(self)self total sum( total amount for in self linesself tax sum( total tax_rate for in self lines