def authenticate(self, **credentials):
        User = get_user_model()
        try:
            lookup_kwargs = get_user_lookup_kwargs({
                "{username}__iexact": credentials["username"]
            })
            user = User.objects.get(**lookup_kwargs)
        except (User.DoesNotExist, __HOLE__):
            return None
        else:
            try:
                if user.check_password(credentials["password"]):
                    return user
            except KeyError:
                return None
dataset/ETHPy150Open pinax/django-user-accounts/account/auth_backends.py/UsernameAuthenticationBackend.authenticate