def _load_words(path):
    'Encapsulates the loading/newfile creation logic.'
    try:
        words = WordList(path)
        print('Words successfully loaded.')
    except FileNotFoundError:
        print(f'No word list found with given name.')
        newfile = force_console_input('Would you like to create a new wordlist with the specified name? Y/N: ', options=['y', 'yes', 'n', 'no'])
        if (newfile[0] == 'y'):
            words = WordList()
            language = force_console_input(query='Which language should be used?\n', onfail='Language not recognised, please try again or check genders.json\n', options=get_languages())
            words.new(language=language)
            print(f'New WordList for language {language} successfully created.')
        else:
            raise IOError
    return words
Encapsulates the loading/newfile creation logic.
def _load_words(path):
    
    try:
        words = WordList(path)
        print('Words successfully loaded.')
    except FileNotFoundError:
        print(f'No word list found with given name.')
        newfile = force_console_input('Would you like to create a new wordlist with the specified name? Y/N: ', options=['y', 'yes', 'n', 'no'])
        if (newfile[0] == 'y'):
            words = WordList()
            language = force_console_input(query='Which language should be used?\n', onfail='Language not recognised, please try again or check genders.json\n', options=get_languages())
            words.new(language=language)
            print(f'New WordList for language {language} successfully created.')
        else:
            raise IOError
    return words