#NEWLINE# def format( self , formatstr ) : #NEWLINE# #INDENT# pieces = [ ] #NEWLINE# for ( i , piece ) in enumerate ( re_formatchars . split ( force_unicode ( formatstr ) ) ) : #NEWLINE# #INDENT# if ( i % 2 ) : #NEWLINE# #INDENT# pieces . append ( force_unicode ( getattr ( self , piece ) ( ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if piece : #NEWLINE# #INDENT# pieces . append ( re_escaped . sub ( '\\1' , piece ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return '' . join ( pieces )