code: def check(self, value, major):
          
          if self._case_insensitive:
              value = value.lower()
              values = self._valid_values_lower
              caseflag = " (case-insensitive)"
          else:
              values = self._valid_values
              caseflag = ""
          if value not in values:
              raise ValueError("Discrete value '%s' is not one of %s%s."
                               % (value, list(self._values), caseflag))
docs: Check whether the value in the set of allowed values.
  
          Raise a ValueError if it is not.