human
What is a the Python program you requested given the following:
Complete the below
def floyd_warshall_all_pairs_distance(graph, heuristic=None, directed=False):

    ''''Floyd-Warshall\'s algorithm for finding the path length for all pairs for nodes.
    Returns a dictionary of node id\'s,
    each linking to a dictionary of node id\'s linking to path length.'
    '''
assistant
#Here is the Python program you requested.
    from collections import defaultdict
    g = graph.keys()
    d = defaultdict((lambda : defaultdict((lambda : 1e+30))))
    p = defaultdict(dict)
    for e in graph.edges:
        u = e.node1.id
        v = e.node2.id
        w = (1.0 - (0.5 * e.weight))
        w = ((heuristic and (heuristic(u, v) + w)) or w)
        d[u][v] = min(w, d[u][v])
        d[u][u] = 0
        p[u][v] = u
        if (not directed):
            d[v][u] = min(w, d[v][u])
            p[v][u] = v
    for w in g:
        dw = d[w]
        for u in g:
            (du, duw) = (d[u], d[u][w])
            for v in g:
                if ((du[v] > duw) and (du[v] > (duw + dw[v]))):
                    d[u][v] = (duw + dw[v])
                    p[u][v] = p[w][v]
    class pdict(dict, ):
        def __init__(self, predecessors, *args, **kwargs):
            dict.__init__(self, *args, **kwargs)
            self.predecessors = predecessors
    return pdict(p, ((u, dict(((v, w) for (v, w) in d[u].items() if (w < 1e+30)))) for u in d))