'Make a ChoiceFormset from the given formset_data.
The data should be given as a list of (choice, votes) tuples.'

def make_choiceformset(self, formset_data=None, formset_class=ChoiceFormSet, total_forms=None, initial_forms=0, max_num_forms=0, **kwargs):

    kwargs.setdefault(u'prefix', u'choices')
    kwargs.setdefault(u'auto_id', False)
    if (formset_data is None):
        return formset_class(**kwargs)
    if (total_forms is None):
        total_forms = len(formset_data)
    def prefixed(*args):
        args = ((kwargs[u'prefix'],) + args)
        return u'-'.join(args)
    data = {prefixed(u'TOTAL_FORMS'): str(total_forms), prefixed(u'INITIAL_FORMS'): str(initial_forms), prefixed(u'MAX_NUM_FORMS'): str(max_num_forms)}
    for (i, (choice, votes)) in enumerate(formset_data):
        data[prefixed(str(i), u'choice')] = choice
        data[prefixed(str(i), u'votes')] = votes
    return formset_class(data, **kwargs)
