def searchElementById(node, Id, tagname):
 nodes = node.getElementsByTagName(tagname)
 for node in nodes:
  an = node.getAttributeNode('id')
  if (an and (an.nodeValue == Id)):
   return node

def searchElementById ( node , Id , tagname ) : nodes = node . getElementsByTagName ( tagname ) for node in nodes : an = node . getAttributeNode ( 'id' ) if ( an and ( an . nodeValue == Id ) ) : return node
search element by id in the all childs and descendant of node .