title: Python: iterate over dictionary keys by sorted value
body: <p>I need to iterate through a dictionary's keys but do it in an order specified by the value.</p>
  
  <p>Example:</p>
  
  <pre><code>myDict = {ID1: 50, ID2: 40, ID3: 60}
  </code></pre>
  
  <p>I would like to somehow do this:</p>
  
  <pre><code>for keyCorrespondingToTheValue in sorted(myDict.values()):
  </code></pre>
  
  <p>--> How can I make this happen?</p>
  
  <p>If the value is a ranking, I wan to go through each ID in order by ranking. I can do this by reversing the key/values in the dictionary, but I don't want to because there is no guarantee that the ranking values are unique.</p>