def sort_versions(version_list):
 versions = []
 for version_obj in version_list:
  version_slug = version_obj.verbose_name
  comparable_version = parse_version_failsafe(version_slug)
  if comparable_version:
   versions.append((version_obj, comparable_version))
 return list(sorted(versions, key=(lambda version_info: version_info[1]), reverse=True))

def sort_versions ( version_list ) : versions = [ ] for version_obj in version_list : version_slug = version_obj . verbose_name comparable_version = parse_version_failsafe ( version_slug ) if comparable_version : versions . append ( ( version_obj , comparable_version ) ) return list ( sorted ( versions , key = ( lambda version_info : version_info [ 1 ] ) , reverse = True ) )
takes a list of version models and return a sorted list .