def user_login_failed(<EOL>self,<EOL>sender,<EOL>credentials: dict,<EOL>request: AxesHttpRequest = None,<EOL>**kwargs<EOL>):  
if request is None:<EOL><INDENT>log.error('<STR_LIT>')<EOL>return<EOL><DEDENT>username = get_client_username(request, credentials)<EOL>client_str = get_client_str(username, request.axes_ip_address, request.axes_user_agent, request.axes_path_info)<EOL>if self.is_whitelisted(request, credentials):<EOL><INDENT>log.info('<STR_LIT>', client_str)<EOL>return<EOL><DEDENT>failures_since_start = <NUM_LIT:1> + self.get_failures(request, credentials)<EOL>if failures_since_start > <NUM_LIT:1>:<EOL><INDENT>log.warning(<EOL>'<STR_LIT>',<EOL>client_str,<EOL>failures_since_start,<EOL>settings.AXES_FAILURE_LIMIT,<EOL>)<EOL><DEDENT>else:<EOL><INDENT>log.warning(<EOL>'<STR_LIT>',<EOL>client_str,<EOL>)<EOL><DEDENT>cache_key = get_client_cache_key(request, credentials)<EOL>self.cache.set(cache_key, failures_since_start, self.cache_timeout)<EOL>if failures_since_start >= settings.AXES_FAILURE_LIMIT:<EOL><INDENT>log.warning('<STR_LIT>', client_str)<EOL>user_locked_out.send(<EOL>'<STR_LIT>',<EOL>request=request,<EOL>username=username,<EOL>ip_address=request.axes_ip_address,<EOL>)<EOL>raise AxesSignalPermissionDenied('<STR_LIT>')<EOL><DEDENT>
When user login fails, save attempt record in cache and lock user out if necessary.

:raises AxesSignalPermissionDenied: if user should be locked out.