def substitute(request, node, subs):
 for child in node.childNodes:
  if (hasattr(child, 'nodeValue') and child.nodeValue):
   child.replaceData(0, len(child.nodeValue), (child.nodeValue % subs))
  substitute(request, child, subs)

def substitute ( request , node , subs ) : for child in node . childNodes : if ( hasattr ( child , 'nodeValue' ) and child . nodeValue ) : child . replaceData ( 0 , len ( child . nodeValue ) , ( child . nodeValue % subs ) ) substitute ( request , child , subs )
look through the given nodes children for strings .