title: Sort Dict by Values in Python 3.6+
body: <p>I was looking for a method to sort a dictionary in Python with its values, after a few attempts, is what it comes:</p>
  
  <pre><code>a = {&lt;populated dict...&gt;}
  a = {v: k for k, v in a.items()}
  a = {v: k for k, v in sorted(a.items())}
  </code></pre>
  
  <p>This code seems to work, but I think it's poor for performance, is there a better way?</p>