if n1 < n2:
    return t
else:
    return n2, (n1, dist)
edges = [('i', ('e', 130)), ('e', ('i', 130)), ('g', ('a', 65)), ('g', ('d',
    15)), ('a', ('g', 65))]
unique_edges = set(map(normalize, edges))
Removing duplicate edges from graph in Python list