human
I wrote the below code

    if ((fgraph is None) and hasattr(var, 'fgraph')):
        fgraph = var.fgraph
    if (fgraph and hasattr(fgraph, 'shape_feature')):
        shape_feature = fgraph.shape_feature
        shape_of = shape_feature.shape_of
        def recur(node):
            if (not (node.outputs[0] in shape_of)):
                for inp in node.inputs:
                    if inp.owner:
                        recur(inp.owner)
                shape_feature.on_import(fgraph, node, 'gof.ops.shape_i')
        if (var not in shape_of):
            recur(var.owner)
        return shape_of[var][i]
    return var.shape[i]

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

def shape_i(var, i, fgraph=None):