code: def SortBy(*qs):
      sort = []
      for q in qs:
          if q._path.endswith('.desc'):
              sort.append((q._path[:-5], DESCENDING))
          else:
              sort.append((q._path, ASCENDING))
      return sort