code: def top_wer_spks(details_by_speaker, top_k=10):
      """
      Finds the K speakers with the highest word error rates.
  
      Useful for diagnostic purposes.
  
      Arguments
      ---------
      details_by_speaker : list
          See output of wer_details_by_speaker.
      top_k : int
          Number of seakers to return.
  
      Returns
      -------
      list
          List of at most K dicts (with the same keys as details_by_speaker)
          of speakers sorted by WER.
      """
      scored_speakers = [
          dets
          for dets in details_by_speaker
          if dets["num_scored_sents"] > 0
      ]
      spks_by_wer = sorted(
          scored_speakers, key=lambda d: d["WER"], reverse=True
      )
      if len(spks_by_wer) >= top_k:
          return spks_by_wer[:top_k]
      else:
          return spks_by_wer
  
file_path: speechbrain/speechbrain/utils/edit_distance.py
imports: import collections
label_desc: Use image node_id 12 for calling a global function with example usage: top_wer_spks(details_by_speaker, top_k) and returns: spks_by_wer, spks_by_wer