title: python dict key sort by multiple values ranking
body: <p>Its easy to sort a dict to list by values, but I need to order keys by kind of boosting specific values in correlation to others.</p>
  
  <p>An example:</p>
  
  <pre><code>x = [('key1', {'s': 'foo', 'w': 30}), ('key2', {'s': 'bar', 'w': 26}),
       ('key3', {'s': 'foo', 'w': 23}), ('key4', {'s': 'bar', 'w': 13})]
  
  result: ['key2', 'key1', 'key3', 'key4']
  </code></pre>
  
  <p>The stuff is ordered by 'w', but for 's' we prefer 'bar' over 'foo' if 'w' hits some treshold. <strong>Is this somehow implemented in python, are there any rules to do this or do you know a python library to handle it?</strong></p>
  
  <p>Its not about learning the features, its about ordering the way I specify - boost or restrict - the values.</p>