def generate_failure(self, code, request, msg='', sign=True, skip_handling_check=False, *args, **kwargs):
    "Generate a response indicating failure.\n\n        This is to be used in all cases where the outcome of user interaction\n        is not success.  This function will refuse to handle a request where\n        the 'fail' parameter is 'yes' (in which case the WLS must not redirect\n        back to the WAA).\n\n        Args:\n            code (int): the response status code.  Values specified in the\n                protocol are available as constants under `ucam_wls.status`.\n            request (AuthRequest): the original WAA request\n            msg (str): an optional message that could be shown to the end user\n                by the WAA\n            sign (bool): whether to sign the response or not.\n\n            *args: passed to `AuthResponse.respond_to_request`\n            **kwargs: passed to `AuthResponse.respond_to_request`\n\n        Returns:\n            An `AuthResponse` instance matching the given arguments.\n\n        Note:\n            Signatures on WLS responses indicating a non-success can optionally\n            be signed.   In the interests of security, the default in this\n            function is to go ahead and sign anyway, but this can be turned off\n            if really desired.\n        "
    self._pre_response(request, skip_handling_check, check_auth_types=False)
    if request.fail:
        raise ValueError('WAA specified that WLS must not redirect back to it on failure')
    if (code == status.SUCCESS):
        raise ValueError('Failure responses must not have success status')
    response = AuthResponse.respond_to_request(*args, request=request, code=code, **kwargs)
    return self._finish_response(response=response, sign=sign)
Generate a response indicating failure.

This is to be used in all cases where the outcome of user interaction
is not success.  This function will refuse to handle a request where
the 'fail' parameter is 'yes' (in which case the WLS must not redirect
back to the WAA).

Args:
    code (int): the response status code.  Values specified in the
        protocol are available as constants under `ucam_wls.status`.
    request (AuthRequest): the original WAA request
    msg (str): an optional message that could be shown to the end user
        by the WAA
    sign (bool): whether to sign the response or not.

    *args: passed to `AuthResponse.respond_to_request`
    **kwargs: passed to `AuthResponse.respond_to_request`

Returns:
    An `AuthResponse` instance matching the given arguments.

Note:
    Signatures on WLS responses indicating a non-success can optionally
    be signed.   In the interests of security, the default in this
    function is to go ahead and sign anyway, but this can be turned off
    if really desired.
def generate_failure(self, code, request, msg=, sign=True, skip_handling_check=False, *args, **kwargs):
    "Generate a response indicating failure.\n\n        This is to be used in all cases where the outcome of user interaction\n        is not success.  This function will refuse to handle a request where\n        the 'fail' parameter is 'yes' (in which case the WLS must not redirect\n        back to the WAA).\n\n        Args:\n            code (int): the response status code.  Values specified in the\n                protocol are available as constants under `ucam_wls.status`.\n            request (AuthRequest): the original WAA request\n            msg (str): an optional message that could be shown to the end user\n                by the WAA\n            sign (bool): whether to sign the response or not.\n\n            *args: passed to `AuthResponse.respond_to_request`\n            **kwargs: passed to `AuthResponse.respond_to_request`\n\n        Returns:\n            An `AuthResponse` instance matching the given arguments.\n\n        Note:\n            Signatures on WLS responses indicating a non-success can optionally\n            be signed.   In the interests of security, the default in this\n            function is to go ahead and sign anyway, but this can be turned off\n            if really desired.\n        "
    self._pre_response(request, skip_handling_check, check_auth_types=False)
    if request.fail:
        raise ValueError('WAA specified that WLS must not redirect back to it on failure')
    if (code == status.SUCCESS):
        raise ValueError('Failure responses must not have success status')
    response = AuthResponse.respond_to_request(*args, request=request, code=code, **kwargs)
    return self._finish_response(response=response, sign=sign)