title: how can i sort python dict to nested list based on key value
body: <p>I have a nested dictionary </p>
  
  <pre><code> d = {'records':[
         {'name':abhi,'age':23,'dept':'cse'}, 
         {'name':anu,'age':20,'dept':'ece'},
         {'name':ammu,'age':25,'dept':'cse'},
         {'name':anju,'age':26,'dept':'ece'}
       ]}
  </code></pre>
  
  <p>but I want to have the dictionary rearranged, grouped by department.  I have done different methods, but did not get the desired result.</p>
  
  <pre><code>d = [
        [ {'name':abhi,'age':23,'dept':'cse'},
          {'name':ammu,'age':25,'dept':'cse'}
        ],
        [ {'name':anu,'age':20,'dept':'ece'},
          {'name':anju,'age':26,'dept':'ece'}
        ]
      ]
  </code></pre>
  
  <p>Any help would be appreciated.</p>