title: How to extract the leaf/branch values of a python n-nested dict efficiently?
body: <p>I have an n-layered dict of dicts and want to get the leaf values by a certain series of keys.</p>
  
  <p>So:</p>
  
  <pre><code>example_dict = {'level_one':
      {'level_two_a':
          {'level_three_a':[1,2,3], 
           'level_three_b':[4,5,6]
          }, 
       'level_two_b':
          {'level_three_c':[7,8,9], 
           'level_three_d':[10,11,12]
          }
      }
  }
  </code></pre>
  
  <p>Sometimes I will want to query:</p>
  
  <pre><code>example_dict['level_one']['level_two_a']['level_three_a']
  </code></pre>
  
  <p>other times I need:</p>
  
  <pre><code>example_dict['level_one']['level_two_b']
  </code></pre>
  
  <p>The real nested dict is very large, so I want to avoid something like:</p>
  
  <pre><code>result_dict = copy.deepcopy(example_dict)
  search_key = ['level_one', 'level_two_a']
  for term in search_key:
   result_dict = copy.deepcopy(result_dict[term])
  </code></pre>
  
  <p>Is there a more memory efficient method?</p>