#NEWLINE# def do_title( s ) : #NEWLINE# #INDENT# 'Return a titlecased version of the value. I.e. words will start with\n    uppercase letters, all remaining characters are lowercase.\n    ' #NEWLINE# rv = [ ] #NEWLINE# for item in re . compile ( '([-\\s]+)(?u)' ) . split ( soft_unicode ( s ) ) : #NEWLINE# #INDENT# if ( not rv ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# rv . append ( ( item [ 0 ] . upper ( ) + item [ 1 : ] . lower ( ) ) ) #NEWLINE# #UNINDENT# return '' . join ( rv )