I have a program that reads an XML document from a socket. I have the XML document stored in a string which I would like to convert directly to a Python dictionary, the same way it is done in Django’s simplejson library. Take as an example: Then dic_xml would look like {‘person’ : { ‘name’ : ‘john’, ‘age’ : 20