<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def speak(self, text):
 """ The main function to convert text into speech. """

        if not self.is_valid_string(text):
            raise Exception("%s is not ISO-8859-1 compatible." % (text))

        # Maximum allowable 1023 characters per message
        if len(text) > 1023:
            lines = self.word_wrap(text, width=1023)
            for line in lines:
                self.queue.put("S%s" % (line))
        else:
            self.queue.put("S%s" % (text))