def reset(ip: str = None, username: str = None) -> int:
attempts = AccessAttempt.objects.all()<EOL>if ip:<EOL><INDENT>attempts = attempts.filter(ip_address=ip)<EOL><DEDENT>if username:<EOL><INDENT>attempts = attempts.filter(username=username)<EOL><DEDENT>count, _ = attempts.delete()<EOL>log.info('<STR_LIT>', count)<EOL>return count<EOL>
Reset records that match IP or username, and return the count of removed attempts.

This utility method is meant to be used from the CLI or via Python API.