code: def coerce(self, value):
          
          if not self.is_valid(value):
              raise ex.SerializeException('{} is not a valid value for '
                                          'type {}'.format(value, self.__class__.__name__))
          return value
docs: Subclasses should override this method for type coercion.
  
          Default version will simply return the argument. If the argument
          is not valid, a SerializeException is raised.
  
          For primitives like booleans, ints, floats, and strings, use
          this default version to avoid unintended type conversions.