code: def _get_line(episode: dict, num_entries: int, entry_idx: int) -> str:
      """
      Return the line to print in the reformatted file.
      """
      episode_done = entry_idx == num_entries - 1
  
      # Compile original context
      if entry_idx == 0:
          # Add those pieces of context that appear in the datasets that this one was
          # based on. Specifically:
          # - Your persona, but not your partner's persona (from ConvAI2)
          # - Topic (from Wizard of Wikipedia)
          # - **Not** the situation (from EmpatheticDialogues)
          persona_pieces = [
              f"your persona: {episode['personas'][1][0]}",
              f"your persona: {episode['personas'][1][1]}",
          ]
          if episode["context_dataset"] == "wizard_of_wikipedia":
              additional_context_pieces = [
                  episode["additional_context"]
              ]
          else:
              additional_context_pieces = []
          previous_utterance_pieces = [
              episode["free_turker_utterance"],
              episode["guided_turker_utterance"],
          ]
          original_context = (
              "\n".join(
                  persona_pieces
                  + additional_context_pieces
                  + previous_utterance_pieces
              )
              + "\n"
          )
      else:
          original_context = ""
  
      # Gather messages and suggestions
      free_message = episode["dialog"][2 * entry_idx][1]
      guided_message = episode["dialog"][2 * entry_idx + 1][1]
      single_task_suggestions = {
          task: episode["suggestions"][2 * entry_idx + 1][task]
          for task in [
              "convai2",
              "empathetic_dialogues",
              "wizard_of_wikipedia",
          ]
      }
      guided_chosen_suggestion = episode["chosen_suggestions"][
          2 * entry_idx + 1
      ]
  
      # Compile into text string
      parts = {
          "text": original_context + free_message,
          "labels": guided_message,
          "context_dataset": episode["context_dataset"],
          "free_message": free_message,
          **single_task_suggestions,
          "guided_chosen_suggestion": guided_chosen_suggestion,
      }
      assert all([isinstance(part, str) for part in parts.values()])
      line = "\t".join(
          [f"{key}:{_escape(value)}" for key, value in parts.items()]
      )
  
      # Add episode_done
      if episode_done:
          line += "\tepisode_done:True"
  
      # Add label_candidates
      if "label_candidates" in episode:
          label_candidates = episode["label_candidates"][entry_idx]
          # Note that episode['dialog'] is indexed by utterance (from either Turker) and
          # episode['label_candidates'] is indexed by guided Turker response
          assert all(
              [isinstance(cand, str) for cand in label_candidates]
          )
          escaped_label_candidates = [
              _escape(cand) for cand in label_candidates
          ]
          line += "\tlabel_candidates:" + "|".join(
              escaped_label_candidates
          )
      return line
  
file_path: ParlAI/parlai/tasks/blended_skill_talk/build.py
imports: import json
  import os
  from parlai.core import build_data
  from parlai.utils.io import PathManager
label_desc: Use image node_id 3 for calling a global function with example usage: _get_line(episode, num_entries, entry_idx) and returns: line