code: def sort_idxs(cls, similarities):
          "Sorts `similarities` and return the indexes in pairs ordered by highest similarity."
          idxs = cls.largest_indices(similarities, len(similarities))
          idxs = [(idxs[0][i], idxs[1][i]) for i in range(len(idxs[0]))]
          return [e for l in idxs for e in lf sort_idxs(cls, similarities):
          "Sorts `similarities` and return the indexes in pairs ordered by highest similarity."
          idxs = cls.largest_indices(similarities, len(similarities))
          idxs = [(idxs[0][i], idxs[1][i]) for i in range(len(idxs[0]))]
          return [e for l in idxs for e in l]
docs: Sorts `similarities` and return the indexes in pairs ordered by highest similarity.