title: Jinja2 templating boolean variables cleanly
body: <p>The following code selects all 3 of the options (though only perhaps one is desirable).</p>
  
  <pre><code>&lt;select id="example-getting-started" name="test" multiple="multiple"&gt;
      &lt;option value="cheese" selected="NO"&gt;Cheese&lt;/option&gt;
      &lt;option value="tomatoes" selected&gt;Tomatoes&lt;/option&gt;
      &lt;option value="mozarella" selected="maybe"&gt;Mozzarella&lt;/option&gt;
      &lt;option value="mushrooms"&gt;Mushrooms&lt;/option&gt;
      &lt;option value="pepperoni"&gt;Pepperoni&lt;/option&gt;
      &lt;option value="onions"&gt;Onions&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>It's not hard to convert this to a Jinja2 template correctly, but it's verbose, and its size grows exponentially with the number of boolean tags. Is there a cleaner solution here? In the example below, <code>pizza_dict</code> is a python dict that associates each topping to the boolean value of whether it is on the pizza.</p>
  
  <pre><code>   &lt;select id="example-getting-started" name="test" multiple="multiple"&gt;
         {% for k in pizza_dict %}
          {% if pizza_dict[k] %}
         &lt;option value="{{ k }}"&gt;{{ k }}&lt;/option&gt;
          {% else %}
         &lt;option value="{{ k }}" selected&gt;{{ k }}&lt;/option&gt;
          {% endif %}
         {% endfor %}
      &lt;/select&gt;
  </code></pre>