code: def _print_predictions(self, batch, gold_label_type):
      lines = []
      if self.predict_spans:
          for datapoint in batch:
              # all labels default to "O"
              for token in datapoint:
                  token.set_label("gold_bio", "O")
                  token.set_label("predicted_bio", "O")
  
              # set gold token-level
              for gold_label in datapoint.get_labels(gold_label_type):
                  gold_span: Span = gold_label.data_point
                  prefix = "B-"
                  for token in gold_span:
                      token.set_label(
                          "gold_bio", prefix + gold_label.value
                      )
                      prefix = "I-"
  
              # set predicted token-level
              for predicted_label in datapoint.get_labels("predicted"):
                  predicted_span: Span = predicted_label.data_point
                  prefix = "B-"
                  for token in predicted_span:
                      token.set_label(
                          "predicted_bio",
                          prefix + predicted_label.value,
                      )
                      prefix = "I-"
  
              # now print labels in CoNLL format
              for token in datapoint:
                  eval_line = (
                      f"{token.text} "
                      f"{token.get_label('gold_bio').value} "
                      f"{token.get_label('predicted_bio').value}\n"
                  )
                  lines.append(eval_line)
              lines.append("\n")
  
      else:
          for datapoint in batch:
              # print labels in CoNLL format
              for token in datapoint:
                  eval_line = (
                      f"{token.text} "
                      f"{token.get_label(gold_label_type).value} "
                      f"{token.get_label('predicted').value}\n"
                  )
                  lines.append(eval_line)
              lines.append("\n")
      return lines
  
imports: import logging
  import tempfile
  from pathlib import Path
  from typing import Any, Dict, List, Optional, Tuple, Union, cast
  from urllib.error import HTTPError
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
  from tqdm import tqdm
  import flair.nn
  from flair.data import Dictionary, Label, Sentence, Span, get_spans_from_bio
  from flair.datasets import DataLoader, FlairDatapointDataset
  from flair.embeddings import TokenEmbeddings
  from flair.file_utils import cached_path, unzip_file
  from flair.models.sequence_tagger_utils.crf import CRF
  from flair.models.sequence_tagger_utils.viterbi import ViterbiDecoder, ViterbiLoss
  from flair.training_utils import store_embeddings
label_desc: Use image node_id 24 for calling the SequenceTagger obj's underlying member method code with example usage: obj._print_predictions(batch, gold_label_type) and returns: lines