<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def fail(self, message, view, type_error=False):
 """Raise an exception indicating that a value cannot be accepted. `type_error` indicates whether the error is due to a type mismatch rather than a malformed value. In this case, a more specific exception is raised. """

        exc_class = ConfigTypeError if type_error else ConfigValueError
        raise exc_class(
            u'{0}: {1}'.format(view.name, message)
        )