def bill_total(bill, tax_rate):
sub_total = 0
taxable_total = 0
for line_item in bill:
line_total = line_item["quantity"] * line_item["item_cost"]
sub_total += line_total
if line_item["taxable"]:
taxable_total += line_total
return sub_total + (taxable_total * tax_rate)