{%- if filetype_loop == 0 %}Port-Channel,Bundle ID,Name,Status,Protocol,Flags,Member Interface,Memeber Bundled,Member Flags
{%-     for interface in to_parse_etherchannel_summary %}
{%-         for member in to_parse_etherchannel_summary[interface].members %}
{{ interface }},{{ to_parse_etherchannel_summary[interface].bundle_id }},{{ to_parse_etherchannel_summary[interface].name }},{{ to_parse_etherchannel_summary[interface].oper_status }},{{ to_parse_etherchannel_summary[interface].protocol | default("Mode On") }},{{ to_parse_etherchannel_summary[interface].flags }},{{ member }},{{ to_parse_etherchannel_summary[interface].members[member].bundled }},{{ to_parse_etherchannel_summary[interface].members[member].flags }}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%-     if filetype_loop == 1 %}
# Etherchannel Summary
| Port-Channel | Bundle ID | Name | Status | Protocol | Flags | Member Interface | Memeber Bundled | Member Flags |
| ------------ | --------- | ---- | ------ | -------- | ----- | ---------------- | --------------- | ------------ |
{%-     for interface in to_parse_etherchannel_summary %}
{%-         for member in to_parse_etherchannel_summary[interface].members %}
| {{ interface }} | {{ to_parse_etherchannel_summary[interface].bundle_id }} | {{ to_parse_etherchannel_summary[interface].name }} | {{ to_parse_etherchannel_summary[interface].oper_status }} | {{ to_parse_etherchannel_summary[interface].protocol | default("Mode On") }} | {{ to_parse_etherchannel_summary[interface].flags }} | {{ member }} | {{ to_parse_etherchannel_summary[interface].members[member].bundled }} | {{ to_parse_etherchannel_summary[interface].members[member].flags }} |
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%-     if filetype_loop == 2 %}
<html><body>
<h1>Show Etherchannel Summary</h1>
<table>
  <thead>
    <tr>
      <th>Port-Channel</th>
      <th>Bundle ID</th>
      <th>Name</th>
      <th>Status</th>
      <th>Protocol</th>
      <th>Flags</th>
      <th>Member Interface</th>
      <th>Member Bundled</th>
      <th>Member Flags</th>
    </tr>
  </thead>
  <tbody>
{%-         for interface in to_parse_etherchannel_summary %}
{%-             for member in to_parse_etherchannel_summary[interface].members %}  
    <tr>
      <td>{{ interface }}</td>
      <td>{{ to_parse_etherchannel_summary[interface].bundle_id }}</td>
      <td>{{ to_parse_etherchannel_summary[interface].name }}</td>
      <td>{{ to_parse_etherchannel_summary[interface].oper_status }}</td>
      <td>{{ to_parse_etherchannel_summary[interface].protocol | default("Mode On") }}</td>
      <td>{{ to_parse_etherchannel_summary[interface].flags }}</td>
      <td>{{ to_parse_etherchannel_summary[interface].members[member].interface }}</td>
      <td>{{ to_parse_etherchannel_summary[interface].members[member].bundled }}</td>
      <td>{{ to_parse_etherchannel_summary[interface].members[member].flags }}</td>
    </tr>
{%-             endfor %}
{%-        endfor %}
  </tbody>
</table>
</body></html>
{%- else %}
# Show Etherchannel Summary
{%-         for interface in to_parse_etherchannel_summary %}
### {{ interface }}
#### Bundle ID: {{ to_parse_etherchannel_summary[interface].bundle_id }}
#### Name: {{ to_parse_etherchannel_summary[interface].name }}
#### Operational Status: {{ to_parse_etherchannel_summary[interface].oper_status }}
#### Protocol: {{ to_parse_etherchannel_summary[interface].protocol | default("Mode On") }}
#### Flags {{ to_parse_etherchannel_summary[interface].flags }}
#### Members
##### {{ to_parse_etherchannel_summary[interface].members[member].interface }}
###### Bundled: {{ to_parse_etherchannel_summary[interface].members[member].bundled }}
###### Flags: {{ to_parse_etherchannel_summary[interface].members[member].flags }}
{%-         endfor %}
{% endif %}{% endif %}{% endif %}