#NEWLINE# def marquee( txt = '' , width = 78 , mark = '*' ) : #NEWLINE# #INDENT# "Return the input string centered in a 'marquee'.\n\n    :Examples:\n\n        In [16]: marquee('A test',40)\n        Out[16]: '**************** A test ****************'\n\n        In [17]: marquee('A test',40,'-')\n        Out[17]: '---------------- A test ----------------'\n\n        In [18]: marquee('A test',40,' ')\n        Out[18]: '                 A test                 '\n\n    " #NEWLINE# if ( not txt ) : #NEWLINE# #INDENT# return ( mark * width ) [ : width ] #NEWLINE# #UNINDENT# nmark = ( ( ( ( width - len ( txt ) ) - 2 ) // len ( mark ) ) // 2 ) #NEWLINE# if ( nmark < 0 ) : #NEWLINE# #INDENT# nmark = 0 #NEWLINE# #UNINDENT# marks = ( mark * marks ) #NEWLINE# return ( '%s %s %s' % ( marks , txt , marks ) )