def locateNodes(nodeList, key, value, noNesting=1):
 returnList = []
 if (not isinstance(nodeList, type([]))):
  return locateNodes(nodeList.childNodes, key, value, noNesting)
 for childNode in nodeList:
  if (not hasattr(childNode, 'getAttribute')):
   continue
  if (str(childNode.getAttribute(key)) == value):
   returnList.append(childNode)
   if noNesting:
    continue
  returnList.extend(locateNodes(childNode, key, value, noNesting))
 return returnList

def locateNodes ( nodeList , key , value , noNesting = 1 ) : returnList = [ ] if ( not isinstance ( nodeList , type ( [ ] ) ) ) : return locateNodes ( nodeList . childNodes , key , value , noNesting ) for childNode in nodeList : if ( not hasattr ( childNode , 'getAttribute' ) ) : continue if ( str ( childNode . getAttribute ( key ) ) == value ) : returnList . append ( childNode ) if noNesting : continue returnList . extend ( locateNodes ( childNode , key , value , noNesting ) ) return returnList
find subnodes in the given node where the given attribute has the given value .