"""greet the user by name ""username get_stored_username( if usernameprint("welcome backusername "!"elseusername input("what is your name"filename 'username jsonwith open(filename' 'as f_objjson dump(usernamef_objprint("we'll remember you when you come backusername "!"greet_user(the new function get_stored_username(has clear purposeas stated in the docstring at this function retrieves stored username and returns the username if it finds one if the file username json doesn' existthe function returns none this is good practicea function should either return the value you're expectingor it should return none this allows us to perform simple test with the return value of the function at we print welcome back message to the user if the attempt to retrieve username was successfuland if it doesn'twe prompt for new username we should factor one more block of code out of greet_user(if the username doesn' existwe should move the code that prompts for new username to function dedicated to that purposeimport json def get_stored_username()"""get stored username if available ""--snip-def get_new_username()"""prompt for new username ""username input("what is your name"filename 'username jsonwith open(filename' 'as f_objjson dump(usernamef_objreturn username def greet_user()"""greet the user by name ""username get_stored_username(if usernameprint("welcome backusername "!"elseusername get_new_username(print("we'll remember you when you come backusername "!"greet_user(files and exceptions