for i in range(len(li)):
    v = first.get(li[i])
if v is None:
    first[li[i]] = i
v = i
li[i] = v
return li
print(canonical_form([1, 1, 1, 0, 0, 2, 6]))
print(canonical_form([2, 2, 2, 9, 9, 3, 1]))
print(canonical_form([2, 2, 2, 9, 9, 3, 3]))
print(canonical_form(['A', 'B', 0, 'D', 0, 'B', 'A']))
print(canonical_form([1, 1, 1, 0, 0, 2, 6]) == canonical_form([2, 2, 2, 9, 
    9, 3, 1]))
print(canonical_form([1, 1, 1, 0, 0, 2, 6]) == canonical_form([2, 2, 2, 9, 
    9, 3, 3]))
How to determine if two partitions (clusterings) of data points are identical?