title: multi dimensional sorting in python
body: <p>I am new to python, need an help to sort below multi-dimensional dictionary by field - "rank"</p>
  
  <pre><code>from operator import *
  from collections import OrderedDict
  print 'Dictionaries:'
  l = {"test":{"rank":61,"test":2},"test1":{"rank":12,"test":2},"test2":{"rank":23,"test":2}}
  </code></pre>
  
  <p>I have tried with below approach, </p>
  
  <pre><code>d_sorted_by_value = OrderedDict(sorted(l.items(), key=attrgetter('rank')))
  </code></pre>
  
  <p>but getting error:</p>
  
  <pre><code>AttributeError: 'tuple' object has no attribute 'rank'
  </code></pre>