title: nested dictionary comprehension
body: <p>For the following nested dictionary I would like to sum  values for each <code>'ab'</code>, <code>'bc'</code>, <code>'cd'</code>, <code>'de'</code> keys respectively. Basically, collapse the dictionary.  Preferably, using comprehension with <code>=sum</code> but cannot figure out the proper syntax:  </p>
  
  <pre><code>{'hot': {'111': {'ab': 1, 'bc': 3, 'cd': 5, 'de': 7}}}
  {'hot': {'111': {'ab': 12.5, 'bc': -31, 'cd': 2.5, 'de': 13}}}
  {'hot': {'111': {'ab': 10, 'bc': 3, 'cd': 0, 'de': -2}}}
  
  {'hot': {'110': {'ab': -1, 'bc': 0, 'cd': 1, 'de': 1}}}
  {'hot': {'110': {'ab': 8, 'bc': 20, 'cd': 41, 'de': 13}}}
  {'hot': {'110': {'ab': 1.75, 'bc': 2.3, 'cd': 6, 'de': 0}}}
  
  {'hot': {'109': {'ab': 2.7, 'bc': 24, 'cd': 4, 'de': 5}}}
  {'hot': {'109': {'ab': 41, 'bc': 6, 'cd': 12, 'de': 33}}}
  {'hot': {'109': {'ab': 32, 'bc': 7, 'cd': 18, 'de': 3.75}}}
  
  {'cold': {'111': {'ab': 25, 'bc': 2, 'cd': 3, 'de': 2.1}}}
  {'cold': {'111': {'ab': 5, 'bc': 8, 'cd': 5, 'de': 17}}}
  {'cold': {'111': {'ab': -71, 'bc': 42, 'cd': 5, 'de': 16}}}
  
  {'cold': {'110': {'ab': 23, 'bc': 2.4, 'cd': 2.1, 'de': 4.3}}}
  {'cold': {'110': {'ab': 11, 'bc': 2.8, 'cd': 4.5, 'de': 2.4}}}
  {'cold': {'110': {'ab': 4, 'bc': 5.7, 'cd': 8.7, 'de': 1}}}        
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>dict['hot']['111'][AB] = 1 + 12.5 + 10 = 23.5
  dict['hot']['111'][BC] = 3 - 31 + 3 = - 25
  </code></pre>
  
  <p>etc</p>