title: Python: Loop through all nested key-value pairs created by xmltodict
body: <p>Getting a specific value based on the layout of an xml-file is pretty straight forward. (See: <a href="https://stackoverflow.com/questions/36253405/python-get-value-with-xmltodict">StackOverflow</a>)</p>
  
  <p>But when I don't know the xml-elements, I can't recurse over it.
  Since xmltodoc nests OrderedDicts in OrderedDicts. These nested OrderedDicts are typified by Python as type: 'unicode'. And not (still) as OrderedDicts. Therefor looping over like this, doens't work:</p>
  
  <pre><code>def myprint(d):
      for k, v in d.iteritems():
          if isinstance(v, list):
              myprint(v)
          else:
              print "Key :{0},  Value: {1}".format(k, v)
  </code></pre>
  
  <p>What I basically want is to recursive over the whole xml-file where every key-value pair is shown. And when a value of a key is another list of key-value pairs, it should recursive into it.</p>
  
  <p>With this xml-file as input:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;session id="2934" name="Valves" docVersion="5.0.1"&gt;
      &lt;docInfo&gt;
          &lt;field name="Employee" isMandotory="True"&gt;Jake Roberts&lt;/field&gt;
          &lt;field name="Section" isOpen="True" isMandotory="False"&gt;5&lt;/field&gt;
          &lt;field name="Location" isOpen="True" isMandotory="False"&gt;Munchen&lt;/field&gt;
      &lt;/docInfo&gt;
  &lt;/session&gt;
  </code></pre>
  
  <p>and the above listed code, all data under session is added as a value to the key session.</p>
  
  <p>Example output:</p>
  
  <pre><code>Key :session,  Value: OrderedDict([(u'@id', u'2934'), (u'@name', u'Valves'), (u'@docVersion', u'5.0.1'), (u'docInfo', OrderedDict([(u'field', [OrderedDict([(u'@name', u'Employee'), (u'@isMandotory', u'True'), ('#text', u'Jake Roberts')]), OrderedDict([(u'@name', u'Section'), (u'@isOpen', u'True'), (u'@isMandotory', u'False'), ('#text', u'5')]), OrderedDict([(u'@name', u'Location'), (u'@isOpen', u'True'), (u'@isMandotory', u'False'), ('#text', u'Munchen')])])]))])
  </code></pre>
  
  <p>And this is obviously not what I want.</p>