title: Sorting a dictionary by value then key
body: <p>I can sort by key or value, but I need it sorted by value, then key, in one line. To explain this better I can show you my problem:</p>
  
  <pre><code>dict = {'apple': 2, 'banana': 3, 'almond':2 , 'beetroot': 3, 'peach': 4}
  </code></pre>
  
  <p>I want my output to be sorted descending by their value and then ascending (A-Z) by their key (alphabetically). Resulting in such a list:</p>
  
  <p>With the output of:   <code>['peach', 'banana', 'beetroot', 'almond', 'apple']</code></p>
  
  <p>The only way I know how to do it so far is:</p>
  
  <pre><code>[v[0] for v in sorted(dict.items(), key=lambda(k,v): (v,k))]
  </code></pre>
  
  <p>With the output of:   <code>['almond', 'apple', 'banana', 'beetroot', 'peach']</code></p>
  
  <p>So it has sorted the values in ascending order and the keys alphabetically in ascending order (A-Z). So if I reverse this:</p>
  
  <pre><code>[v[0] for v in sorted(dict.items(), key=lambda(k,v): (v,k), reverse=True)]
  </code></pre>
  
  <p>With the output of:   <code>['peach', 'beetroot', 'banana', 'apple', 'almond']</code></p>
  
  <p>It has sorted the values in descending order and the keys alphabetically in descending order (Z-A). </p>
  
  <p>Is there a way I can sort the values in descending order and the keys in ascending order (i.e. A-Z) and get the output I showed above?</p>