def edge_color_weight(G,edgelist=None):
    """Automatically calculate a normalized reasonable color for
    a weighted graph

    Parameters:
    -----------
    G: A networkx Graph
    edgelist: A list
      Edges to calculate the weights for if None, uses all edges
    Returns:
    --------
    weight_dict: A dictionary
       Values between 0-1 that displays nicely in matplotlib.
    """
    cl = {}
    if edgelist is None:
        edgelist=G.edges()
    for (u,v) in edgelist:
        cl[(u,v)] = G[u][v]['weight']
    maxw = max(cl.values())
    minw = float(min(cl.values()))
    return dict(list(zip(list(cl.keys()), \
                    list(map((lambda x: (x-minw)/(maxw - minw)),list(cl.values()))))))