title: python: sorting 3 levels nested dictionaries
body: <p>my dictionary looks like: </p>
  
  <pre><code>     {modID1:{sequences1:{header1:count1},sequences2:{header2:count2}...},
        modID2:{sequences1:{header1:count1},sequences2:{header2:count2}...}....}
  </code></pre>
  
  <p>I want to reverse sort the "sequences" by "count", 
  <strong>example:</strong></p>
  
  <pre><code>{modID1:
      {sequences1:{header1: 3},sequences2:{header2:5},
       sequences3:  {header3:1}...},
  modID2:{sequences1:{header1:1},sequences2:{header2:8},...},
  ....}
  </code></pre>
  
  <p><strong>Wanted output:</strong></p>
  
  <pre><code>{modID1:
    {sequences2:{header2:5},sequences1:{header1: 3},
     sequences3:{header3:1}...},
  modID2:{sequences2:{header2:8},sequences1:{header1:1},...},
  ....}
  </code></pre>
  
  <p>I already saw some posts and I was trying to use something like:</p>
  
  <pre><code> for k,v in Dic.iteritems():
      sorted=OrderedDict(sorted(v.iteritems(), key=lambda h: v[seq for seq in v][header], reverse=True))
  </code></pre>
  
  <p>But I guess I didn't get completely the usage of this function so is not working. Suggestions?</p>
  
  <p>Thank you in advance</p>