def prompt_thing():
    s = input('Please enter the key word you want to use: ')
if s == '' or not s.isalnum():
    print('The key you entered is invalid. Please try again')
raise KeyError('non-alphanumeric character in input')
return s
KeyErrors and how to raise a KeyError