def root_etree_to_dict(element, iterable=(list, list.append)):
 return {element.tag: iterable[0]([etree_to_dict(element, iterable)])}

def root_etree_to_dict ( element , iterable = ( list , list . append ) ) : return { element . tag : iterable [ 0 ] ( [ etree_to_dict ( element , iterable ) ] ) }
takes an xml root element and returns the corresponding dict .