code: def parse_conversations(tree_obj):
      """recusive function that returns all the sub converstaions in a list starting from node tree_obj
  
      Args:
          tree_obj (obj): current conversation node
  
      Returns:
          a list of sub conversation threads including the current conversation node
      """
      if "prompt" in tree_obj:
          prompt_obj = tree_obj["prompt"]
      elif "text" in tree_obj and "role" in tree_obj:
          prompt_obj = tree_obj
      else:
          return [[]]
      if prompt_obj["role"] == "prompter":
          role = "User"
      elif prompt_obj["role"] == "assistant":
          role = "Assistant"
      else:
          raise ValueError(f'unknown role {prompt_obj["role"]}')
      turn = {"value": prompt_obj["text"], "from": role}
      if "labels" in prompt_obj:
          # remove human labels
          # turn['human_labels'] = prompt_obj['labels']
          # for key in turn['human_labels']:
          #     value_set = label_values.get(key, set())
          #     value_set.add(turn['human_labels'][key]['value'])
          #     label_values[key] = value_set
          turn["label"] = encode_labels(prompt_obj["labels"])
      if "lang" in prompt_obj:
          turn["lang"] = prompt_obj["lang"].split("-")[0]
          if turn["label"] == "":
              turn["label"] = f'lang:{turn["lang"]}'
          else:
              turn["label"] = turn["label"] + f',lang:{turn["lang"]}'
          value_set = label_values.get("lang", set())
          value_set.add(turn["lang"])
          label_values["lang"] = value_set
      all_conversations = []
      multiple_sub_threads = []
      for next_obj in prompt_obj["replies"]:
          multiple_threads = parse_conversations(next_obj)
          multiple_sub_threads.extend(multiple_threads)
      if len(multiple_sub_threads) != 0:
          for sub_thread in multiple_sub_threads:
              all_conversations.append([turn] + sub_thread)
      else:
          all_conversations.append([turn])
      return all_conversations
  
imports: import json
  import random
  import fire
label_desc: Use image node_id 2 for calling a global function with example usage: parse_conversations(tree_obj) and returns: all_conversations, list