"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]))"