human
I wrote the below code

    from sympy.matrices.expressions import MatrixExpr, MatrixSymbol, MatMul, MatAdd
    if (opt_subs is None):
        opt_subs = dict()
    to_eliminate = set()
    seen_subexp = set()
    def _find_repeated(expr):
        if (not isinstance(expr, Basic)):
            return
        if (expr.is_Atom or expr.is_Order):
            return
        if iterable(expr):
            args = expr
        else:
            if (expr in seen_subexp):
                for ign in ignore:
                    if (ign in expr.free_symbols):
                        break
                else:
                    to_eliminate.add(expr)
                    return
            seen_subexp.add(expr)
            if (expr in opt_subs):
                expr = opt_subs[expr]
            args = expr.args
        list(map(_find_repeated, args))
    for e in exprs:
        if isinstance(e, Basic):
            _find_repeated(e)
    replacements = []
    subs = dict()
    def _rebuild(expr):
        if (not isinstance(expr, Basic)):
            return expr
        if (not expr.args):
            return expr
        if iterable(expr):
            new_args = [_rebuild(arg) for arg in expr]
            return expr.func(*new_args)
        if (expr in subs):
            return subs[expr]
        orig_expr = expr
        if (expr in opt_subs):
            expr = opt_subs[expr]
        if (order != 'none'):
            if isinstance(expr, (Mul, MatMul)):
                (c, nc) = expr.args_cnc()
                if (c == [1]):
                    args = nc
                else:
                    args = (list(ordered(c)) + nc)
            elif isinstance(expr, (Add, MatAdd)):
                args = list(ordered(expr.args))
            else:
                args = expr.args
        else:
            args = expr.args
        new_args = list(map(_rebuild, args))
        if (new_args != args):
            new_expr = expr.func(*new_args)
        else:
            new_expr = expr
        if (orig_expr in to_eliminate):
            try:
               ...

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

def tree_cse(exprs, symbols, opt_subs=None, order='canonical', ignore=()):