def comparable_version(version_string):
 comparable = parse_version_failsafe(version_string)
 if (not comparable):
  if (version_string == LATEST_VERBOSE_NAME):
   comparable = Version('99999.0')
  elif (version_string == STABLE_VERBOSE_NAME):
   comparable = Version('9999.0')
  else:
   comparable = Version('0.01')
 return comparable

def comparable_version ( version_string ) : comparable = parse_version_failsafe ( version_string ) if ( not comparable ) : if ( version_string == LATEST_VERBOSE_NAME ) : comparable = Version ( '99999.0' ) elif ( version_string == STABLE_VERBOSE_NAME ) : comparable = Version ( '9999.0' ) else : comparable = Version ( '0.01' ) return comparable
this can be used as key argument to sorted .