// for each unique different street, iterate its key + 1 so it"s unique
for u, v, k in set(different_streets):
// filter out key if it appears in data dict as we"ll pass it explicitly
attributes = {k: v for k, v in G[u][v][k].items() if k != "key"}
G.add_edge(u, v, key=k + 1, **attributes)
G.remove_edge(u, v, key=k)
After Change
utils.log(f"Found {len(set_different_streets)} different streets")
for u, v, k in set(different_streets):
new_key = max(list(G[u][v]) + list(G[v][u])) + 1
G.add_edge(u, v, key=new_key, **G.get_edge_data(u, v, k))
G.remove_edge(u, v, key=k)
return G