Let's say I have this list of tuples:
[(30, 'B'), (50, 'B'), (40, 'C'), (10, 'A'), (80, 'A'), (5, 'A')]
I need to sort the tuples by their second element in descending order but with the condition that all of the tuples with an identical second element are next to one another.
So, it should look like
[(80, 'A'), (10, 'A'), (5, 'A'), (50, 'B'), (30, 'B'), (40, 'C')]
How can I do this?