def discount(customer): if customer.type == 3: return 0.15 if customer.type == 7 or customer.type == 12: return 0.2 if customer.since < 1262304000: return 0.25 return 0