title: Sorting dictionary keys by value, then those with the same value alphabetically
body: <p>I know it wasn't well explained in the title so I'll try and do a better job here. I want to sort a dictionary's keys by their respective values, and then sort any keys with the same value alphabetically. What is the best way to do this, ideally without the use of modules? </p>
  
  <p>Does python do this automatically with a sort like:</p>
  
  <pre><code>sorted(dictionary.items(), key=lambda x: x[1])
  </code></pre>
  
  <p>I tried the above code and it seemed to work but I couldn't tell if it was just coincidence or not. I couldn't find anything in the docs and I need to know if it will always work.</p>
  
  <p>Starting dictionary:</p>
  
  <pre><code>dictionary = {'d':2, 'c':1, 'a':2, 'b':3}
  </code></pre>
  
  <p>Sorted by value:</p>
  
  <pre><code>['c', 'd', 'a', 'b']
  </code></pre>
  
  <p>(1, 2, 2, 3)</p>
  
  <p>Items with the same value sorted alphabetically:</p>
  
  <pre><code>['c', 'a', 'd', 'b']
  </code></pre>
  
  <p>(1, 2, 2, 3)</p>