title: pythonic way to create 3d dict
body: <p>I want to create a dict which can be accessed as:</p>
  
  <pre><code>d[id_1][id_2][id_3] = amount
  </code></pre>
  
  <p>As of now I have a huge ugly function:</p>
  
  <pre><code> def parse_dict(id1,id2,id3,principal, data_dict):
          if data_dict.has_key(id1):
             values = data_dict[id1]
             if values.has_key[id2]
                ..
          else:
              inner_inner_dict = {}
               # and so on
  </code></pre>
  
  <p>What is the pythonic way to do this?</p>
  
  <p>note, that i input the principal.. but what i want is the amount..
  So if all the three keys are there.. add principal to the previous amount!</p>
  
  <p>Thanks</p>