title: python dict. if statement
body: <p>Can someone assist me on the proper placement of an if statement on my dict. I am try to flag any user that is NY and have them come first in the dictionary.  I am able to get sort by name which I require as well but not clear how to flag any NY users </p>
  
  <pre><code>names_states = {
    'user1': 'CA',
    'user2': 'NY',
    'user7': 'CA',
    'guest': 'MN',
  }
  
  
  for key in sorted(names_states.iterkeys()):
     2   ...   print "%s :  %s" %(key, names_states[key])
     3   ...
     4   user1 :  CA
     5   user2 :  NY
     6   guest :  MN
     7   user7 :  CA
  </code></pre>