human
I wrote the below code

    def compare_roots(a, b):
        if (a.value and re.split(u'\\W+', a.value)[0].isdigit()):
            return cmp(a.value, b.value)
        if ((a.report_type != b.report_type) and (a.report_type == u'Balance    Sheet')):
            return (-1)
        if ((a.root_type != b.root_type) and (a.root_type == u'Asset')):
            return (-1)
        if ((a.root_type == u'Liability') and (b.root_type == u'Equity')):
            return (-1)
        if ((a.root_type == u'Income') and (b.root_type == u'Expense')):
            return (-1)
        return 1
    roots.sort(compare_roots)

What's a good function header?
assistant
#Here's a good function header.

def sort_root_accounts(roots):