<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def to_data(self, value):
        '''
        Coerce python data type to simple form for serialization.
        If default value was defined returns the default value if None was passed.
        Throw exception is value is ``None`` is ``required`` is set to ``True``
        '''
        try:
            if value is None and self._default is not None:
                return self._export(self.default)
            self._check_required(value)
            value = self._export(value)
            return value
        except ValueError as ex:
            raise ValueError(ex, self._errors['to_data'])