code: def format_chats_orig(chats):
      """
      Original hobbot chat format stored the dialogues as newline separated text, and the
      bot and human personas as strings.
  
      The choice and location appear in the dialogue history as strings.
      """
      chats = [
          c
          for c in chats
          if c["dialogue"] is not None
          and len(c["dialogue"].split("\\n")) > 1
      ]
  
      converted_chats = []
      for c in chats:
          try:
              # set up personas
              old_human_persona = c["human_persona"].split("\\n")
              c["human_persona"] = {
                  "id": None,
                  "name": old_human_persona[0],
                  "persona": old_human_persona[1],
                  "db_id": None,
              }
              old_bot_persona = c["bot_persona"].split("\\n")
              c["bot_persona"] = {
                  "id": None,
                  "name": old_bot_persona[0],
                  "persona": old_bot_persona[1],
                  "db_id": None,
              }
  
              old_dialogue_turns = c["dialogue"].split("\\n")
              if old_dialogue_turns[0].startswith("Human:"):
                  # The very first 125 chats we collected didn't add the
                  # specific location, so there are two possibilities.
                  # We select the possible location with the
                  # most word overlap with the chat.
                  use_location = (
                      select_location_from_rough_string_match(
                          old_human_persona[2],
                          old_bot_persona[2],
                          old_dialogue_turns,
                      )
                  )
                  old_dialogue_turns = [
                      use_location
                  ] + old_dialogue_turns
              # extract location:
              location_turn_split = old_dialogue_turns[0].split(", ")
              c["location"] = {
                  "id": None,
                  "name": location_turn_split[0],
                  "description": ", ".join(location_turn_split[1:]),
                  "db_id": None,
              }
  
              # parse through dialogue
              new_dialogue = []
              c["choice"] = None
              BOT_TAG = "Bot: "
              CHOICE_TAG = "CHOICE: "
              HUMAN_TAG = "Human: "
              c["score"] = int(c["score"])
              score_per_turn = c["score"] / max(
                  1, len(old_dialogue_turns) / 2
              )
              for turn in old_dialogue_turns[1:]:
                  if turn.startswith(BOT_TAG):
                      new_dialogue.append(
                          {
                              "id": "bot",
                              "type": "speech",
                              "text": turn[len(BOT_TAG) :],
                          }
                      )
                  elif turn.startswith(HUMAN_TAG):
                      new_dialogue.append(
                          {
                              "id": "human",
                              "type": "speech",
                              "text": turn[len(HUMAN_TAG) :],
                              "score": score_per_turn,
                          }
                      )
                  elif turn.startswith(CHOICE_TAG):
                      c["choice"] = {
                          "id": "human",
                          "type": "choice",
                          "text": turn[len(CHOICE_TAG) :],
                      }
              c["dialogue"] = new_dialogue
              c["is_complete"] = c["choice"] is not None
              c["did_continue"] = (
                  c["choice"] is not None
                  and c["choice"]["text"] != "EXIT"
              )
              converted_chats.append(c)
          except Exception:
              if c["ds"] == "2020-06-23":
                  # We expect some chats from this day to have
                  # broken formatting
                  continue
              else:
                  raise
  
      return converted_chats
  
imports: import random
  import io
  import os
  import json
  from parlai.utils.misc import msg_to_str
label_desc: Use image node_id 12 for calling a global function with example usage: format_chats_orig(chats) and returns: converted_chats