#NEWLINE# def write_dictionary( dictionary , args ) : #NEWLINE# #INDENT# '\n    Write the dictionary to file.\n\n    Return a list of paths, or None if failed.\n    ' #NEWLINE# output_format = args . output_format #NEWLINE# if ( output_format == 'bookeen' ) : #NEWLINE# #INDENT# import penelope.format_bookeen #NEWLINE# return penelope . format_bookeen . write ( dictionary , args , args . output_file ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( output_format == 'csv' ) : #NEWLINE# #INDENT# output_file_path = add_extension ( args . output_file , '.csv' ) #NEWLINE# import penelope.format_csv #NEWLINE# return penelope . format_csv . write ( dictionary , args , output_file_path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( output_format == 'epub' ) : #NEWLINE# #INDENT# output_file_path = add_extension ( args . output_file , '.epub' ) #NEWLINE# import penelope.format_epub #NEWLINE# return penelope . format_epub . write ( dictionary , args , output_file_path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( output_format == 'kobo' ) : #NEWLINE# #INDENT# output_file_path = get_kobo_file_path ( args ) #NEWLINE# import penelope.format_kobo #NEWLINE# return penelope . format_kobo . write ( dictionary , args , output_file_path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( output_format == 'mobi' ) : #NEWLINE# #INDENT# output_file_path = add_extension ( args . output_file , '.mobi' ) #NEWLINE# import penelope.format_mobi #NEWLINE# return penelope . format_mobi . write ( dictionary , args , output_file_path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( output_format == 'stardict' ) : #NEWLINE# #INDENT# output_file_path = add_extension ( args . output_file , '.zip' ) #NEWLINE# import penelope.format_stardict #NEWLINE# return penelope . format_stardict . write ( dictionary , args , output_file_path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( output_format == 'xml' ) : #NEWLINE# #INDENT# output_file_path = add_extension ( args . output_file , '.xml' ) #NEWLINE# import penelope.format_xml #NEWLINE# return penelope . format_xml . write ( dictionary , args , output_file_path ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return False