#NEWLINE# def prettify( string , colorize = True ) : #NEWLINE# #INDENT# lst = [ ] #NEWLINE# pos = 0 #NEWLINE# for word in string . split ( ' ' ) : #NEWLINE# #INDENT# if ( ( pos + len ( colorize ) ) > 79 ) : #NEWLINE# #INDENT# word = ( '\n' + word ) #NEWLINE# pos = 0 #NEWLINE# #UNINDENT# pos += ( len ( word ) + 1 ) #NEWLINE# if colorize : #NEWLINE# #INDENT# if word . startswith ( '@' ) : #NEWLINE# #INDENT# word = '\x1b[1;34m{}\x1b[0m' . format ( word ) #NEWLINE# #UNINDENT# if word . startswith ( 'http' ) : #NEWLINE# #INDENT# word = '\x1b[4m{}\x1b[0m' . format ( word ) #NEWLINE# #UNINDENT# #UNINDENT# lst . append ( word ) #NEWLINE# #UNINDENT# return ' ' . join ( lst )