human
I wrote the below code

    if (consider_constant is None):
        consider_constant = []
    else:
        try:
            iter(consider_constant)
        except TypeError:
            raise TypeError(('consider_constant    must    be    an    iterable    collection,    got    ' + str(type(consider_constant))))
        for elem in consider_constant:
            if (not isinstance(elem, gof.Variable)):
                raise TypeError(('Elements    of    consider_constant    must    be    variables,    but    got    ' + str(type(elem))))
    var_to_app_to_idx = OrderedDict()
    accounted_for = set([])
    def account_for(var):
        if (var in accounted_for):
            return
        accounted_for.add(var)
        if (var in consider_constant):
            return
        if (var.owner is not None):
            app = var.owner
            connection_pattern = _node_to_pattern(app)
            var_idx = app.outputs.index(var)
            for (i, ipt) in enumerate(app.inputs):
                if (not connection_pattern[i][var_idx]):
                    continue
                if (ipt not in var_to_app_to_idx):
                    var_to_app_to_idx[ipt] = OrderedDict()
                app_to_idx = var_to_app_to_idx[ipt]
                if (app not in app_to_idx):
                    app_to_idx[app] = []
                idx = app_to_idx[app]
                if (i not in idx):
                    idx.append(i)
                account_for(ipt)
    for output in outputs:
        account_for(output)
    visited = set([])
    def visit(var):
        if (var in visited):
            return
        if (var not in var_to_app_to_idx):
            return
        visited.add(var)
        nodes = var_to_app_to_idx[var]
        for node in nodes:
            connection_pattern = _node_to_pattern(node)
            for idx in nodes[node]:
                for (ii, output) in enumerate(node.outputs):
                    if connection_pattern[idx][ii]:
                        visit(output)
    for elem in wrt:
        visit(elem)
    orig_vars =...

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

def _populate_var_to_app_to_idx(outputs, wrt, consider_constant):