#NEWLINE# def is_already_locked( request ) : #NEWLINE# #INDENT# ip = get_ip ( request ) #NEWLINE# if ONLY_WHITELIST : #NEWLINE# #INDENT# if ( not ip_in_whitelist ( ip ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# if ip_in_blacklist ( ip ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# user_lockable = is_user_lockable ( request ) #NEWLINE# if ( not user_lockable ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# attempts = get_user_attempts ( request ) #NEWLINE# for attempt in attempts : #NEWLINE# #INDENT# if ( ( attempt . failures_since_start >= FAILURE_LIMIT ) and LOCK_OUT_AT_FAILURE ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# return False