code: def print_worst_lines(r, n_worst_lines):
      if len(r["single"]) != len(r["ids"]):
          raise Exception(
              "Mismatch in number of predictions and gt files"
          )
  
      sorted_lines = sorted(
          zip(r["single"], r["ids"]), key=lambda a: -a[0][1]
      )
  
      if n_worst_lines < 0:
          n_worst_lines = len(r["ids"])
  
      if n_worst_lines > 0:
          print(
              "{:60s} {:4s} {:3s} {:3s} {}".format(
                  "GT FILE", "LEN", "ERR", "SER", "CONFUSIONS"
              )
          )
          for (
              len_gt,
              errs,
              sync_errs,
              confusion,
              gt_pred,
          ), gtid in sorted_lines[:n_worst_lines]:
              print(
                  "{:60s} {:4d} {:3d} {:3d} {}".format(
                      gtid[-60:], len_gt, errs, sync_errs, confusion
                  )
              )
  
file_path: calamari/calamari_ocr/scripts/eval.py
imports: from dataclasses import dataclass, field
  from typing import Optional
  import tfaip.util.logging
  import numpy
  from calamari_ocr.ocr.dataset.params import DATA_GENERATOR_CHOICES
  from paiargparse import PAIArgumentParser, pai_dataclass, pai_meta
  from calamari_ocr.ocr import SavedCalamariModel
  from calamari_ocr.ocr.dataset.datareader.base import CalamariDataGeneratorParams
  from calamari_ocr.ocr.dataset.datareader.file import FileDataParams
  from calamari_ocr.ocr.evaluator import EvaluatorParams
label_desc: Use image node_id 2 for calling a global function with example usage: print_worst_lines(r, n_worst_lines) without return types