def _Execute(statements, context, callback):
 for (i, statement) in enumerate(statements):
  if isinstance(statement, basestring):
   callback(statement)
  else:
   try:
    (func, args) = statement
    func(args, context, callback)
   except UndefinedVariable as e:
    start = max(0, (i - 3))
    end = (i + 3)
    e.near = statements[start:end]
    raise

def _Execute ( statements , context , callback ) : for ( i , statement ) in enumerate ( statements ) : if isinstance ( statement , basestring ) : callback ( statement ) else : try : ( func , args ) = statement func ( args , context , callback ) except UndefinedVariable as e : start = max ( 0 , ( i - 3 ) ) end = ( i + 3 ) e . near = statements [ start : end ] raise
execute a bunch of template statements in a scopedcontext .