'Django-compatibility method for option rendering.
Should only render selected options, by setting self.choices before
calling the parent method.
Remove this code when dropping support for Django<1.10.'

def render_options(self, *args):

    selected_choices_arg = (1 if (VERSION < (1, 10)) else 0)
    selected_choices = [six.text_type(c) for c in args[selected_choices_arg] if c]
    all_choices = copy.copy(self.choices)
    if self.url:
        self.filter_choices_to_render(selected_choices)
    elif (not self.allow_multiple_selected):
        if self.placeholder:
            self.choices.insert(0, (None, ''))
    html = super(WidgetMixin, self).render_options(*args)
    self.choices = all_choices
    return html
