Validates that the input is in self.choices.

def clean(self, value):
        """
        Validates that the input is in self.choices.
        """
        value = super().clean(value)
        if value in (None, ''):
            value = ''
        value = smart_text(value)
        if value == '':
            return value
        valid_values = []
        for group_label, group in self.choices:
            valid_values += [str(k) for k, v in group]
        if value not in valid_values:
            raise ValidationError(gettext('Select a valid choice. That choice is not one of the available choices.'))
        return value