code: def scores2recos(self, scores, candidates, rev=False):
          sorted_indices = np.argsort(scores)
          if rev:
              sorted_indices = sorted_indices[::-1]
          return candidates[sorted_indices], scores[sorted_indices]