we can also add method to check whether particular username is logged in deciding whether to use an exception here is trickier should we raise an exception if the username does not existshould we raise an exception if the user is not logged into answer these questionswe need to think about how the method would be accessed most oftenthis method will be used to answer the yes/no question"should allow them access to ?the answer will either be"yesthe username is valid and they are logged in"or "nothe username is not valid or they are not logged inthereforea boolean return value is sufficient there is no need to use exceptions herejust for the sake of using an exception def is_logged_in(selfusername)if username in self usersreturn self users[usernameis_logged_in return false finallywe can add default authenticator instance to our module so that the client code can access it easily using auth authenticatorauthenticator authenticator(this line goes at the module leveloutside any class definitionso the authenticator variable can be accessed as auth authenticator now we can start on the authorizor classwhich maps permissions to users the authorizor class should not permit user access to permission if they are not logged inso they'll need reference to specific authenticator we'll also need to set up the permission dictionary upon initializationclass authorizordef __init__(selfauthenticator)self authenticator authenticator self permissions {now we can write methods to add new permissions and to set up which users are associated with each permissiondef add_permission(selfperm_name)'''create new permission that users can be added to''tryperm_set self permissions[perm_nameexcept keyerrorself permissions[perm_nameset(else