function jscode_namespace(iter_name, action, parent_id) {
    var _clean= '';
    if (action === 'store') {
        _clean = ' = {}'
    }
    var res = 'for(var attr in this.blocks){' +
              'eval("var " + attr + " = this.blocks[attr]")'+
           '};' +
           'var $locals_' + iter_name + ' = this.env' + _clean + ', '+
               '$local_name = "' + iter_name + '", ' +
               '$locals = $locals_' + iter_name + ';'
    if(parent_id){
        res += '$locals.$parent = $locals_' + parent_id.replace(/\./g, "_") +
            ';'
    }
    return res
}