there are two new exceptions in herethey both take usernamesso we'll define them as subclasses of authexceptionclass notloggedinerror(authexception)pass class notpermittederror(authexception)pass finallywe can add default authorizor to go with our default authenticatorauthorizor authorizor(authenticatorthat completes basic authentication/authorization system we can test the system at the python promptchecking to see whether userjoeis permitted to do tasks in the paint departmentimport auth auth authenticator add_user("joe""joepassword"auth authorizor add_permission("paint"auth authorizor check_permission("paint""joe"traceback (most recent call last)file ""line in file "auth py"line in check_permission raise notloggedinerror(usernameauth notloggedinerrorjoe auth authenticator is_logged_in("joe"false auth authenticator login("joe""joepassword"true auth authorizor check_permission("paint""joe"traceback (most recent call last)file ""line in file "auth py"line in check_permission raise notpermittederror(usernameauth notpermittederrorjoe auth authorizor check_permission("mix""joe"traceback (most recent call last)file "auth py"line in check_permission perm_set self permissions[perm_name