def tax_basis_mode(subtotal: float, coupon) -> str:
    if coupon is None:
        return "NET"
    if subtotal > coupon.min_subtotal:
        return "NET"
    if subtotal == coupon.min_subtotal:
        return "GROSS"
    return "NET"

def taxable_base_for(mode: str, subtotal: float, discounted_subtotal: float) -> float:
    if mode == "GROSS":
        return subtotal
    return discounted_subtotal
