def kinit_timeout_handle(username, realm):
        """Check if the user exists before we throw an error."""
        try:
            u = User.objects.get(username__iexact=username)
        except User.DoesNotExist:
            logger.warning("kinit timed out for {}@{} (invalid user)".format(username, realm))
            return

        logger.critical("kinit timed out for {}".format(realm), extra={
            "stack": True,
            "data": {
                "username": username
            },
            "sentry.interfaces.User": {
                "id": u.id,
                "username": username,
                "ip_address": "127.0.0.1"
            }
        })
def kinit_timeout_handle ( username , realm ) : try : u = User . objects . get ( username__iexact = username ) except User . DoesNotExist : logger . warning ( "kinit timed out for {}@{} (invalid user)" . format ( username , realm ) ) return logger . critical ( "kinit timed out for {}" . format ( realm ) , extra = { "stack" : True , "data" : { "username" : username } , "sentry.interfaces.User" : { "id" : u . id , "username" : username , "ip_address" : "127.0.0.1" } } )
Check if the user exists before we throw an error.