Create a pronunciation dictionary specific to a list of recordings

def create_recordings_dictionary(list_selected, pronunciation_dictionary_filename, out_dictionary_filename, htk_trace,
                                 additional_dictionary_filenames=[]):
    """Create a pronunciation dictionary specific to a list of recordings"""
    temp_words_fd, temp_words_file = tempfile.mkstemp()

    words = set()
    for recording in list_selected:
        words |= set([w.upper() for w in get_words_from_recording(recording)])

    with codecs.open(temp_words_file, 'w', 'utf-8') as f:
        f.writelines([u'{}\n'.format(w) for w in sorted(list(words))])

    prepare_dictionary(temp_words_file,
                       pronunciation_dictionary_filename,
                       out_dictionary_filename,
                       htk_trace,
                       global_script_filename=config.project_path('etc/global.ded'),
                       additional_dictionary_filenames=additional_dictionary_filenames)

    os.remove(temp_words_file)

    return