code: def build_for_each(self, db, safe_mode=False, extra=None):
          
          result = dict()
          for var, query in iteritems(self.for_each):
              result[var] = db.query(
                  query,
                  additional_locals=extra,
                  safe_mode=safe_mode
              )
          return result
docs: Builds the for-each context.