def sort_lines(lines):
    return lines.sorted((lambda line: (line.exclude_from_invoice_tab, (not bool(line.tax_line_id)), (line.name or ''), line.balance)))
def sort_lines(lines):
    return lines.sorted((lambda line: (line.exclude_from_invoice_tab, (not bool(line.tax_line_id)), (line.name or ), line.balance)))