title: Is there a recursive version of the dict.get() built-in?
body: <p>I have a nested dictionary object and I want to be able to retrieve values of keys with an arbitrary depth.  I'm able to do this by subclassing <code>dict</code>:</p>
  
  <pre><code>&gt;&gt;&gt; class MyDict(dict):
  ...     def recursive_get(self, *args, **kwargs):
  ...         default = kwargs.get('default')
  ...         cursor = self
  ...         for a in args:
  ...             if cursor is default: break
  ...             cursor = cursor.get(a, default)
  ...         return cursor
  ... 
  &gt;&gt;&gt; d = MyDict(foo={'bar': 'baz'})
  &gt;&gt;&gt; d
  {'foo': {'bar': 'baz'}}
  &gt;&gt;&gt; d.get('foo')
  {'bar': 'baz'}
  &gt;&gt;&gt; d.recursive_get('foo')
  {'bar': 'baz'}
  &gt;&gt;&gt; d.recursive_get('foo', 'bar')
  'baz'
  &gt;&gt;&gt; d.recursive_get('bogus key', default='nonexistent key')
  'nonexistent key'
  </code></pre>
  
  <p>However, I don't want to have to subclass <code>dict</code> to get this behavior.  Is there some built-in method that has equivalent or similar behavior?  If not, are there any standard or external modules that provide this behavior?</p>
  
  <p>I'm using Python 2.7 at the moment, though I would be curious to hear about 3.x solutions as well.</p>