#NEWLINE# def _sort_model( self ) : #NEWLINE# #INDENT# ' Sorts the underlying model if that is what the user requested.\n        ' #NEWLINE# editor = self . editor #NEWLINE# sorted = ( editor . factory . sort_model and ( self . _sorter is not None ) ) #NEWLINE# if sorted : #NEWLINE# #INDENT# items = self . __items ( False ) [ : ] #NEWLINE# items . sort ( key = self . _sorter ) #NEWLINE# if ( self . reverse ^ self . _reverse ) : #NEWLINE# #INDENT# items . reverse ( ) #NEWLINE# #UNINDENT# editor . value = self #NEWLINE# #UNINDENT# return sorted