#NEWLINE# def _binify( cols , line_width ) : #NEWLINE# #INDENT# adjoin_width = 1 #NEWLINE# bins = [ ] #NEWLINE# curr_width = 0 #NEWLINE# i_last_column = ( len ( cols ) - 1 ) #NEWLINE# for ( i , w ) in enumerate ( cols ) : #NEWLINE# #INDENT# w_adjoined = ( w + adjoin_width ) #NEWLINE# curr_width += w_adjoined #NEWLINE# if ( wrap == i ) : #NEWLINE# #INDENT# wrap = ( ( ( curr_width + 1 ) > line_width ) and ( i > 0 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# wrap = ( ( ( curr_width + 2 ) > line_width ) and ( i > 0 ) ) #NEWLINE# #UNINDENT# if wrap : #NEWLINE# #INDENT# bins . append ( i ) #NEWLINE# curr_width = w_adjoined #NEWLINE# #UNINDENT# #UNINDENT# bins . append ( len ( cols ) ) #NEWLINE# return bins