title: Sort Dictionary of Dictionaries on multiple child dictionary values
body: <p>I have a dictionary that looks like this:</p>
  
  <pre><code>myDict = {
      'SER12346': {'serial_num': 'SER12346', 'site_location': 'North America'},
      'ABC12345': {'serial_num': 'ABC12345', 'site_location': 'South America'},
      'SER12345': {'serial_num': 'SER12345', 'site_location': 'North America'},
      'SER12347': {'serial_num': 'SER12347', 'site_location': 'South America'},
      'ABC12346': {'serial_num': 'ABC12346', 'site_location': 'Europe'}
  }
  </code></pre>
  
  <p>My goal is to sort this dictionary by the <code>site_location</code> and the <code>serial_num</code> of each of the child dictionaries. </p>
  
  <p>Using code I found in this question - <a href="https://stackoverflow.com/questions/10592480/sort-a-dictionary-of-dictionaries-python">Sort a dictionary of dictionaries python</a> - I was able to get it sorted, but it's not quite what I am expecting. </p>
  
  <p>This is my code:</p>
  
  <pre><code>import pprint
  items = ((k, k2, v) for k in myDict for k2, v in myDict[k].items())
  ordered = sorted(items, key=lambda x:x[-1], reverse=False)
  pprint.pprint(ordered)
  </code></pre>
  
  <p>This is the result I get:</p>
  
  <pre><code>[('ABC12346', 'site_location', 'Europe'),
   ('SER12345', 'site_location', 'North America'),
   ('SER12346', 'site_location', 'North America'),
   ('SER12347', 'site_location', 'South America'),
   ('ABC12345', 'site_location', 'South America'),
   ('ABC12346', 'serial_num': 'ABC12346'),
   ('SER12345', 'serial_num': 'SER12345'),
   ('SER12346', 'serial_num': 'SER12346'),
   ('SER12347', 'serial_num': 'SER12347'),
   ('ABC12345', 'serial_num': 'ABC12345')]
  </code></pre>
  
  <p>I was expecting something more like this though:</p>
  
  <pre><code>{
      'ABC12346': {'serial_num': 'ABC12346', 'site_location': 'Europe'}
      'SER12345': {'serial_num': 'SER12345', 'site_location': 'North America'},
      'SER12346': {'serial_num': 'SER12346', 'site_location': 'North America'},
      'SER12347': {'serial_num': 'SER12347', 'site_location': 'South America'},
      'ABC12345': {'serial_num': 'ABC12345', 'site_location': 'South America'},
  }
  </code></pre>
  
  <p>The actual result is separating the serial number and site location. I want to keep them together in the sorted object. How can I do this?</p>