<DescribeTagsResponse xmlns="http://ec2.amazonaws.com/doc/2013-06-15/">
   <requestId><%= @request_id %></requestId>
   <tagSet>
      <% impool.each do |im| %>
        <% if (state_image = im.render_state) && im.has_elements?("TEMPLATE/EC2_TAGS") %>
          <% image_hash = im.to_hash %>
          <% image_hash["IMAGE"]["TEMPLATE"]["EC2_TAGS"].each do |key, value| %>
      <item>
         <resourceId><%= im.ec2_id %></resourceId>
         <resourceType><%= im.resource_type %></resourceType>
         <key><%= key %></key>
         <value><%= value %></value>
      </item>
          <% end
        end
      end %>
      <% vmpool.each do |vm| %>
        <% if include_terminated_instance?(vm) && vm.has_elements?("USER_TEMPLATE/EC2_TAGS") %>
          <% vm_hash = vm.to_hash %>
          <% vm_hash["VM"]["USER_TEMPLATE"]["EC2_TAGS"].each do |key, value| %>
      <item>
         <resourceId>i-<%= sprintf('%08i', vm.id) %></resourceId>
         <resourceType>instance</resourceType>
         <key><%= key %></key>
         <value><%= value %></value>
      </item>
          <% end
        end
      end %>
    </tagSet>
</DescribeTagsResponse>
