Add utility to set filename attribute on all nodes
diff --git a/Lib/compiler/misc.py b/Lib/compiler/misc.py
index 9cbd73f..b4bbe78 100644
--- a/Lib/compiler/misc.py
+++ b/Lib/compiler/misc.py
@@ -64,3 +64,12 @@
         klass = klass[:MANGLE_LEN-tlen]
 
     return "_%s%s" % (klass, name)
+
+def set_filename(filename, tree):
+    """Set the filename attribute to filename on every node in tree"""
+    worklist = [tree]
+    while worklist:
+        node = worklist.pop(0)
+        node.filename = filename
+        worklist.extend(node.getChildNodes())
+