# if we are the "template" def, fudge locally declared/modified variables into the "__locals" dictionary,
# if we are the "template" def, fudge locally declared/modified variables into the "__M_locals" dictionary,
# which is used for def calls within the same template, to simulate "enclosing scope"
self.printer.writeline('__locals.update(dict([(k, locals()[k]) for k in [%s] if k in locals()]))'%','.join([repr(x)forxinnode.declared_identifiers()]))
self.printer.writeline('__M_locals.update(dict([(__M_key, locals()[__M_key]) for __M_key in [%s] if __M_key in locals()]))'%','.join([repr(x)forxinnode.declared_identifiers()]))