def get_attributes_by_tag_name(dom, tag_name):
 elem = dom.getElementsByTagName(tag_name)[0]
 return dict(list(elem.attributes.items()))

def get_attributes_by_tag_name ( dom , tag_name ) : elem = dom . getElementsByTagName ( tag_name ) [ 0 ] return dict ( list ( elem . attributes . items ( ) ) )
retrieve an attribute from an xml document and return it in a consistent format only used with xml .