<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def output(self, result):
 """ Adapts the result of a function based on the returns definition. """

        if self.returns:
            errors = None
            try:
                return self._adapt_result(result)
            except AdaptErrors as e:
                errors = e.errors
            except AdaptError as e:
                errors = [e]

            raise AnticipateErrors(
                message='Return value %r does not match anticipated type %r'
                    % (type(result), self.returns),
                errors=errors)
        elif self.strict:
            if result is not None:
                raise AnticipateErrors(
                    message='Return value %r does not match anticipated value '
                    'of None' % type(result),
                    errors=None)
            return None
        else:
            return result