"Sort a list of tuples by second value, reverse=True and then by key, reverse=False","sorted(d, key=lambda x: (-x[1], x[0]))"