def version_sort(sortable, *fields, **kwargs):
 def _version_sort_key(item):
  result = SemVer(semver_compat(item))
  if fields:
   values = [result]
   for field in fields:
    values.append(item[field])
   result = tuple(values)
  return result
 try:
  return sorted(sortable, key=_version_sort_key, **kwargs)
 except ValueError as e:
  console_write(u'\n            Error sorting versions - %s\n            ', e)
  return []

def version_sort ( sortable , * fields , ** kwargs ) : def _version_sort_key ( item ) : result = SemVer ( semver_compat ( item ) ) if fields : values = [ result ] for field in fields : values . append ( item [ field ] ) result = tuple ( values ) return result try : return sorted ( sortable , key = _version_sort_key , ** kwargs ) except ValueError as e : console_write ( u'\n            Error sorting versions - %s\n            ' , e ) return [ ]
sorts a list that is a list of versions .