python collections counter sort code example
Example: collections counter sort by value
>>> Counter('abracadabra').most_common(3)
[('a', 5), ('r', 2), ('b', 2)]
>>> Counter('abracadabra').most_common(3)
[('a', 5), ('r', 2), ('b', 2)]