a = [['a', 'b'], ['b'], ['b', 'a']]
Because the 1st and 3rd element are the same, if they are converted to a set, I want to sort the list 'a' so that any two elements with the same set value would be next to each other. For the example above, the sorted result would be:
a = [['a', 'b'], ['b', 'a'], ['b']]
OR
a = [['b'], ['a', 'b'], ['b', 'a']]