human
I wrote the below code

    def prim_to_list(prim, args):
        if isinstance(prim, deap.gp.Terminal):
            if (prim.name in pset.context):
                return pset.context[prim.name]
            else:
                return prim.value
        return ([prim.name] + args)
    tree = []
    stack = []
    for node in ind:
        stack.append((node, []))
        while (len(stack[(-1)][1]) == stack[(-1)][0].arity):
            (prim, args) = stack.pop()
            tree = prim_to_list(prim, args)
            if (len(stack) == 0):
                break
            stack[(-1)][1].append(tree)
    return tree

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

def expr_to_tree(ind, pset):