{% for value, label in [('choice1', '选项1'), ('choice2', '选项2')] %}
            {% if ratio == value %}
                {% set checked = "checked" %}
            {% else %}
                {% set checked = "" %}
            {% endif %}
            <input type="radio" name="ratio" value="{{value}}" {{checked}} /> {{label}}
        {% endfor %}

def input_ratio(self, name, choices, labels, multi_line=False):
        """        
        {% for value, label in [('choice1', '选项1'), ('choice2', '选项2')] %}
            {% if ratio == value %}
                {% set checked = "checked" %}
            {% else %}
                {% set checked = "" %}
            {% endif %}
            <input type="radio" name="ratio" value="{{value}}" {{checked}} /> {{label}}
        {% endfor %}
        """
        if len(choices) != len(labels):
            raise ValueError("The size of 'choices' and 'labels' doesn't match!")
        
        choice_label = list(zip(choices, labels))
        
        lines = list()
        lines.append('{%% for value, label in %s %%}' % repr(choice_label))
        lines.append(self.tab + '{%% if %s == value %%}' % name)
        lines.append(self.tab * 2 + '{% set checked = "checked" %}')
        lines.append(self.tab + '{% else %}')
        lines.append(self.tab * 2 + '{% set checked = "" %}')
        lines.append(self.tab + '{% endif %}')
        if multi_line:
            line_break = "<br>"
        else:
            line_break = ""
        lines.append(self.tab + '<input type="radio" name="%s" value="{{value}}" {{checked}} /> {{label}} %s' % (name, line_break))
        lines.append('{% endfor %}')
        return "\n".join(lines)