code: function copycontext(context) {
      var t = {};
      var keys =  context.keys();
      var i = keys.length;
      var k, v, j;
      while (i--) {
        k = keys[i];
        if (k[0] == '_')
          continue;
        v = context.get(k);
        if (v && {}.toString.call(v) === '[object Function]')
          continue;
  
        try {
          j = JSON.stringify(v);
          t[k] = JSON.parse(j);
        } catch(err) {
          t[k] = "Exception: " + err;
        }
      }
      
      return t;
    }
docs: prepare context object for serialization