code: def __to_file(self, message_no):
          
          filename = self.__create_file_name(message_no)
          try:
              with codecs.open(filename, mode='w',
                               encoding=self.messages[message_no].encoding)\
                      as file__:
                  file__.write(self.messages[message_no].output)
          except IOError as excep:
              print 'Unable for open the file \'{0}\' for writing. The '\
                    'following exception was raised:'.format(filename)
              print excep
              print 'Exiting!'
              sys.exit(2)
          return filename
docs: Write a single message to file