Format the text for output adding ASCII frame around the text.

    Args:
        text (str): Text that needs to be formatted.

    Returns:
        str: Formatted string.
434733
def format_page(text):
    
    width = max(map(len, text.splitlines()))
    page = "+-" + "-" * width + "-+\n"
    for line in text.splitlines():
        page += "| " + line.ljust(width) + " |\n"
    page += "+-" + "-" * width + "-+\n"
    return page
1055289
def concatenate(ctx, *text):
    
    result = ''
    for arg in text:
        result += conversions.to_string(arg, ctx)
    return result
432691
def text(self, max_lines=sys.maxsize):
        
        ret_val = []
        block = self._trigger.next()
        _, end = self.get_range()
        while (block.isValid() and block.blockNumber() <= end and
               len(ret_val) < max_lines):
            ret_val.append(block.text())
            block = block.next()
        return '\n'.join(ret_val)
119075
def _colourise(text: str, colour: str) -> str:
    
    if COLOUR:
        text = style(text, fg=colour, bold=True)
    return text
572126
def append_message(self, text, output_format=OutputFormat.NormalMessageFormat):
        
        self._append_message(text, self._formats[output_format])
886232
def add_text(self, text):
        
        t = self._r.add_t(text)
        return _Text(t)
625180
def write(self, text):
        ''

        # Add color to the terminal.
        if not self.no_color:
            text = self.colorize_text(text)
        else:
            pattern = re.compile('\<\<[A-Z]*?\>\>')
            text = pattern.sub('', text)

        text += '\n'

        self.buffer.write(text)

        return self
435795
def wrapwrite(text):
    
    try:  # Python3
        sys.stdout.buffer.write(text)
    except AttributeError:
        sys.stdout.write(text.encode('utf-8'))
270555
def append(self,text):
        
        if text is Text:
            text = Text(self, id=self.id + '.text.' + str(len(self.data)+1) )
        elif text is Speech:
            text = Speech(self, id=self.id + '.speech.' + str(len(self.data)+1) ) #pylint: disable=redefined-variable-type
        else:
            assert isinstance(text, Text) or isinstance(text, Speech)
        self.data.append(text)
        return text
442407
def speak(self, text):
        
        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))
229733
def format_message(self, message):
        
        look = Look(message)
        return look.pretty(display=False)
59905
def unicode2ascii(text, expand=True):
    
    """
    translate = UTF8_TO_ASCII if not expand else UTF8_TO_MULTIASCII
    output = ''
    for c in text:
        if not c or ord(c) < 128:
            output += c
        else:
            output += translate[c] if c in translate else ' '
    return output.strip()
858350
def _tokenize(self, text):
        
        sentences = []
        tokens = []
        for word in self._clean_accents(text).split(' '):
            tokens.append(word)
            if '.' in word:
                sentences.append(tokens)
                tokens = []
        return sentences
922376
def format_color(text, color, use_color_setting):
    
    if not use_color_setting:
        return text
    else:
        return '{}{}{}'.format(color, text, NORMAL)
545936
def text(self):
        
        if not self.content:
            return

        if self.encoding:
            return self.content.decode(self.encoding, errors='replace')

        return self.content.decode(self.guess_encoding(), errors='replace')
144338
def html(self, text=TEXT):
        
        self.logger.debug("Generating the HTML report{}..."
                          .format(["", " (text only)"][text]))
        html = []
        for piece in self._pieces:
            if isinstance(piece, string_types):
                html.append(markdown2.markdown(piece, extras=["tables"]))
            elif isinstance(piece, Element):
                html.append(piece.html())
        return "\n\n".join(html)
1218929
def Write(self, Text):
        
        self.Application._Alter('WRITE', '%s %s' % (self.Handle, tounicode(Text)))