def deannotate_snapshot(s, out=nil)
      val = if s.has_key? :value
        if s[:value].is_a? String
          Base64.decode64(s[:value])
        else
          s[:value]
        end
      elsif s.has_key? :contents
        if s[:contents_type].to_s == 'hash'
          s[:contents].reduce({}) {|h, c| deannotate_snapshot(c, h) }
        elsif s[:contents_type].to_s == 'array'
          s[:contents].reduce([]) {|a, c| deannotate_snapshot(c, a) }
        else
          raise "Expected hash or array for contents_type, got #{s[:contents_type]}"
        end
      else
        raise "Snapshot has neither :value nor :contents key"
      end

      if out.nil? # top level item
        val
      elsif out.is_a? Hash
        raise "Expected :name for snapshot item within a hash" unless s.has_key? :name
        out[s[:name].to_sym] = val
        out
      elsif out.is_a? Array
        out << val
      else
        raise "Ooops!  out param s/b hash or array, but it was #{out.class}"
      end
    end
def deannotate_snapshot(s, out=nil)
      val = if s.has_key? :value
        if s[:value].is_a? String
          Base64.decode64(s[:value])
        else
          s[:value]
        end
      elsif s.has_key? :contents
        if s[:contents_type].to_s == 'hash'
          s[:contents].reduce({}) {|h, c| deannotate_snapshot(c, h) }
        elsif s[:contents_type].to_s == 'array'
          s[:contents].reduce([]) {|a, c| deannotate_snapshot(c, a) }
        else
          raise "Expected hash or array for contents_type, got #{s[:contents_type]}"
        end
      else
        raise "Snapshot has neither :value nor :contents key"
      end

      if out.nil? # top level item
        val
      elsif out.is_a? Hash
        raise "Expected :name for snapshot item within a hash" unless s.has_key? :name
        out[s[:name].to_sym] = val
        out
      elsif out.is_a? Array
        out << val
      else
        raise "Ooops!  out param s/b hash or array, but it was #{out.class}"
      end
    end
turns the output of #annotated_snapshot into the format used by
 #snapshot and #assign  XXX not fully tested w/ compound elements, esp arrays