code: def rerank(self, hypotheses: Dict[str, Any], reference: str) -> Dict[str, Any]:
          scores = [self.scoring_function(hypothesis, reference) for hypothesis in hypotheses['translations']]
          ranking = list(np.argsort(scores, kind='mergesort')[::-1])
          reranked_hypotheses = self._sort_by_ranking(hypotheses, ranking)
          if self.return_score:
              reranked_hypotheses['scores'] = [scores[i] for i in ranking]
          return reranked_hypotheses