title: recursive itemgetter for python
body: <p>Is there a recursive <code>itemgetter</code> in python. Let's say you have an object like </p>
  
  <pre><code>d = {'a': (1,2,3), 'b': {1: (5,6)}}
  </code></pre>
  
  <p>and I wanted to get the first element of the tuple from <code>d['a']</code>? As far as I can tell <code>itemgetter</code> will only do one level, i.e. get me <code>a</code> or <code>b</code> or both.</p>
  
  <p>Is there some clever way of combining <code>itertools</code> with <code>itemgetter</code> to produce the desired result.</p>
  
  <p>So basically what I want to be able to call is </p>
  
  <pre><code>from operator import itemgetter
  d = {'a': (1,2), 'b': (4, (5,))}
  itemgetter({'a': 0})(d) --&gt; 1
  itemgetter({'b': 0})(d) --&gt; 4
  itemgetter({'b': {1: 0}})(d) --&gt; 5
  
  d = {'a': {'b': (1,2,3)}}
  itemgetter({'a': {'b': 2}})(d) --&gt; 3
  </code></pre>