code: def sortedSemver(versions, sort="asc"):
      if versions and isinstance(versions, (list, tuple)):
          if PY2:
              return sorted(versions, cmp=semver.compare, reverse=True if sort.upper() == "DESC" else False)
          else:
              from functools import cmp_to_key
              return sorted(versions, key=cmp_to_key(semver.compare), reverse=True if sort.upper() == "DESC" else False)
      else:
          raise TypeError("Invaild Versions, a list or tuple is right.")