title: Python: Convert a nested list of tuples of lists into a dictionary?
body: <p>I have a nested list of tuples of lists (of tuples, etc.) that looks like this:</p>
  
  <pre class="lang-python prettyprint-override"><code>[(' person', 
  [(('surname', u'Doe', True),), 
  (('name', u'John', False),), 
  ('contact', 
  [(('email', u'john@doe.me', True),), 
  (('phone', u'+0123456789', False),), 
  (('fax', u'+0987654321', False),)]), 
  ('connection', 
  [(('company', u'ibcn', True),), 
  ('contact', 
  [(('email', u'mail@ibcn.com', True),), 
  (('address', u'main street 0', False),), 
  (('city', u'pythonville', False),), 
  (('fax', u'+0987654321', False),)])])])]
  </code></pre>
  
  <p>There is no way of knowing neither the number of (double) tuples within a list nor how deep nesting goes. </p>
  
  <p>I want to convert it to a nested dictionary (of dictionaries), eliminating the boolean values, like this:</p>
  
  <pre class="lang-python prettyprint-override"><code>{'person': {'name': 'John', 'surname': 'Doe', 
      'contact': {'phone': '+0123456789', 'email': 'john@doe.me','fax': '+0987654321',
      'connection': {'company name': 'ibcn', 'contact':{'phone': '+2345678901',
                     'email': 'mail@ibcn.com', 'address': 'main street 0'
                     'city': 'pythonville', 'fax': +0987654321'
  }}}}}
  </code></pre>
  
  <p>All I have, so far, is a recursive method that can print the nested structure in a per-line fashion:</p>
  
  <pre class="lang-python prettyprint-override"><code>def tuple2dict(_tuple):
      for item in _tuple:
          if type(item) == StringType or type(item) == UnicodeType:
              print item
          elif type(item) == BooleanType:
              pass
          else:
              tuple2dict(item)
  </code></pre>
  
  <p>but, I'm not sure I'm on the right track...</p>
  
  <p>EDIT:
  I've edited the original structure, since it was missing a comma.</p>