dd = {"a":"a","b":{"cc":"cc","dd":{"eee":"eee"}}}
def dict_to_xml(data):
def to_xml(data):
xx = []
for k,v in data.iteritems():
if isinstance(v,dict):
aa = to_xml(v)
s = "<{key}>{value}{key}>".format(key=k,value=aa)
else:
s = "<{key}>{value}{key}>".format(key=k,value=v)
xx.append(s)
return ''.join(xx)
return ''+to_xml(data)+' '
print dict_to_xml(dd)