def set_filename(filename, tree):
 worklist = [tree]
 while worklist:
  node = worklist.pop(0)
  node.filename = filename
  worklist.extend(node.getChildNodes())

def set_filename ( filename , tree ) : worklist = [ tree ] while worklist : node = worklist . pop ( 0 ) node . filename = filename worklist . extend ( node . getChildNodes ( ) )
set the filename attribute to filename on every node in tree .