code: def multi_sort(remotes, sort):
      
      exploded_alpha = list()
      exploded_semver = list()
  
      # Convert name to int if alpha is in sort.
      if 'alpha' in sort:
          alpha_max_len = max(len(r['name']) for r in remotes)
          for name in (r['name'] for r in remotes):
              exploded_alpha.append([ord(i) for i in name] + [0] * (alpha_max_len - len(name)))
  
      # Parse versions if semver is in sort.
      if 'semver' in sort:
          exploded_semver = semvers(r['name'] for r in remotes)
  
      # Build sort_mapping dict.
      sort_mapping = dict()
      for i, remote in enumerate(remotes):
          key = list()
          for sort_by in sort:
              if sort_by == 'alpha':
                  key.extend(exploded_alpha[i])
              elif sort_by == 'time':
                  key.append(-remote['date'])
              elif sort_by == 'semver':
                  key.extend(exploded_semver[i])
          sort_mapping[id(remote)] = key
  
      # Sort.
      remotes.sort(key=lambda k: sort_mapping.get(id(k)))
docs: Sort `remotes` in place. Allows sorting by multiple conditions.
  
      This is needed because Python 3 no longer supports sorting lists of multiple types. Sort keys must all be of the
      same type.
  
      Problem: the user expects versions to be sorted latest first and timelogical to be most recent first (when viewing
      the HTML documentation), yet expects alphabetical sorting to be A before Z.
      Solution: invert integers (dates and parsed versions).
  
      :param iter remotes: List of dicts from Versions().remotes.
      :param iter sort: What to sort by. May be one or more of: alpha, time, semver