def __init__(self)self username none self menu_map "login"self login"test"self test"change"self change"quit"self quit def login(self)logged_in false while not logged_inusername input("username"password input("password"trylogged_in auth authenticator loginusernamepasswordexcept auth invalidusernameprint("sorrythat username does not exist"except auth invalidpasswordprint("sorryincorrect password"elseself username username def is_permitted(selfpermission)tryauth authorizor check_permissionpermissionself usernameexcept auth notloggedinerror as eprint("{is not logged informat( username)return false except auth notpermittederror as eprint("{cannot {}formate usernamepermission)return false elsereturn true def test(self)if self is_permitted("test program")print("testing program now "def change(self)if self is_permitted("change program")print("changing program now "def quit(self)