#NEWLINE# def compare_versions( self , version1 , version2 ) : #NEWLINE# #INDENT# def normalize( v ) : #NEWLINE# #INDENT# return [ int ( x ) for x in re . sub ( '(\\.0+)*$' , '' , v ) . split ( '.' ) ] #NEWLINE# #UNINDENT# return cmp ( normalize ( version1 ) , normalize ( version2 ) )