human
I wrote the below code

    if (method == 'sqf'):
        def key(obj):
            (poly, exp) = obj
            rep = poly.rep.rep
            return (exp, len(rep), len(poly.gens), rep)
    else:
        def key(obj):
            (poly, exp) = obj
            rep = poly.rep.rep
            return (len(rep), len(poly.gens), exp, rep)
    return sorted(factors, key=key)

What's a good function header?

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

def _sorted_factors(factors, method):