'Bring the latest version (and wheels) to the front, but maintain the existing ordering as secondary.
See the docstring for `_link_sort_key` for details.
This function is isolated for easier unit testing.'

def _sort_versions(self, applicable_versions):

    return sorted(applicable_versions, key=self._link_sort_key, reverse=True)
