def compare_package(version1, version2):
 def normalize(v):
  return [int(x) for x in re.sub('(\\.0+)*$', '', v).split('.')]
 return cmp(normalize(version1), normalize(version2))

def compare_package ( version1 , version2 ) : def normalize ( v ) : return [ int ( x ) for x in re . sub ( '(\\.0+)*$' , '' , v ) . split ( '.' ) ] return cmp ( normalize ( version1 ) , normalize ( version2 ) )
compare version packages .