def pre_validate(self, form):
        if self.data:
            values = self.choice_values
            for value in self.data:
                if value not in values:
                    raise ValueError(
                        self.gettext(
                            "'%(value)s' is not a valid"
                            " choice for this field"
                        ) % dict(value=value)
                    )
dataset/ETHPy150Open kvesteri/wtforms-components/wtforms_components/fields/select_multiple.py/SelectMultipleField.pre_validate/original