I was looking for a method to sort a dictionary in Python with its values, after a few attempts, is what it comes:
a = {<populated dict...>}
a = {v: k for k, v in a.items()}
a = {v: k for k, v in sorted(a.items())}
This code seems to work, but I think it's poor for performance, is there a better way?