code: def to_dict(self, xml):
          
          children = list(xml)
          if not children:
              return xml.text
          else:
              out = {}
              for node in list(xml):
                  if node.tag in out:
                      if not isinstance(out[node.tag], list):
                          out[node.tag] = [out[node.tag]]
                      out[node.tag].append(self.to_dict(node))
                  else:
                      out[node.tag] = self.to_dict(node)
              return out
docs: Convert XML structure to dict recursively, repeated keys
          entries are returned as in list containers.