python, tenjin generate nested ul li menu.
<p>How to generate menu with python and tenjin, like this</p>

<pre><code>&lt;ul&gt; 
    &lt;li&gt;&lt;a href="#"&gt;About Us&lt;/a&gt;
        &lt;ul&gt;
            &lt;li&gt;&lt;a href="#"&gt;About Page 1&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#"&gt;About Page 2&lt;/a&gt;&lt;/li&gt; 
        &lt;/ul&gt;
    &lt;/li&gt; 
&lt;/ul&gt;
</code></pre>

<p>mysql table
section section_local   model   model_local
wax     wax_rus         a300    a300_rus
wax     wax_rus         a400    a400_rus</p>

<p>this is from python</p>

<pre><code>page_content = { 'section': _section, 'model': _model, 'section_local':_section_local, 'model_local':_model_local}
</code></pre>

<p>this is in template(but it doesn't work)</p>

<pre><code>&lt;?py list = [] ?&gt;

&lt;?py  for  item_section_local, item_model_local in zip(section_local, model_local):?&gt;
&lt;?py if item_section_local not in list: ?&gt;
&lt;?py list.append(item_section_local) ?&gt;
&lt;?py print 'adding item to list'?&gt;
&lt;?py #endif ?&gt;
&lt;?py if item_section_local in list: ?&gt;                                        
&lt;?py break ?&gt;
&lt;?py #endif ?&gt;
&lt;li&gt;&lt;a class="title"     href="/${lang}/products/${item_section_local}/"&gt;${item_section_local}&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a  href="/${lang}/products/${item_section_local}/${item_model_local}"&gt;${item_model_local}&lt;/a&gt;     &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;?py #endfor ?&gt;  
</code></pre>

<p>the problem is - when it generate page the section is duplicating. </p>

<pre><code>&lt;ul&gt; 
&lt;li&gt;&lt;a href="#"&gt;wax&lt;/a&gt;
    &lt;ul&gt;
        &lt;li&gt;&lt;a href="#"&gt;a300&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
&lt;/li&gt; 
</code></pre>

<p></p>

<pre><code> &lt;ul&gt; 
    &lt;li&gt;&lt;a href="#"&gt;wax&lt;/a&gt;
        &lt;ul&gt;
            &lt;li&gt;&lt;a href="#"&gt;a400&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt; 
   &lt;/ul&gt;
</code></pre>

<p>But I need:
    <ul> 
    <li>wax
        <ul>
            <li>a300</li>
                        <li>a300</li>
        </ul>
    </li> 
   </ul></p>
