code: def get_sort_spec(self):
          
          all_indexes = self.catalog.get_indexes()
          si = req.get_sort_on(allowed_indexes=all_indexes)
          so = req.get_sort_order()
          return si, so
docs: Build sort specification