human
I wrote the below code

    old = expr
    first = opts.pop('first', True)
    if first:
        if (not expr.has(*_trigs)):
            return expr
        trigsyms = set().union(*[t.free_symbols for t in expr.atoms(*_trigs)])
        if (len(trigsyms) > 1):
            d = separatevars(expr)
            if d.is_Mul:
                d = (separatevars(d, dict=True) or d)
            if isinstance(d, dict):
                expr = 1
                for (k, v) in d.items():
                    was = v
                    v = expand_mul(v)
                    opts['first'] = False
                    vnew = trigsimp(v, **opts)
                    if (vnew == v):
                        vnew = was
                    expr *= vnew
                old = expr
            elif d.is_Add:
                for s in trigsyms:
                    (r, e) = expr.as_independent(s)
                    if r:
                        opts['first'] = False
                        expr = (r + trigsimp(e, **opts))
                        if (not expr.is_Add):
                            break
                old = expr
    recursive = opts.pop('recursive', False)
    deep = opts.pop('deep', False)
    method = opts.pop('method', 'matching')
    def groebnersimp(ex, deep, **opts):
        def traverse(e):
            if e.is_Atom:
                return e
            args = [traverse(x) for x in e.args]
            if (e.is_Function or e.is_Pow):
                args = [trigsimp_groebner(x, **opts) for x in args]
            return e.func(*args)
        if deep:
            ex = traverse(ex)
        return trigsimp_groebner(ex, **opts)
    trigsimpfunc = {'matching': (lambda x, d: _trigsimp(x, d)), 'groebner': (lambda x, d: groebnersimp(x, d, **opts)), 'combined': (lambda x, d: _trigsimp(groebnersimp(x, d, polynomial=True, hints=[2, tan]), d))}[method]
    if recursive:
        (w, g) = cse(expr)
        g = trigsimpfunc(g[0], deep)
        for sub in reversed(w):
            g = g.subs(sub[0], sub[1])
            g = trigsimpfunc(g, deep)
        result =...

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

def trigsimp_old(expr, **opts):