code: def flatten_personas(personas: Dict, delim="\n", bb3_format=False):
      personass_str_parts = []
      if bb3_format:
          for i, p in enumerate(personas):
              personass_str_parts.append(
                  f"Person {i+1} is: {p['name']}"
              )
              personass_str_parts.append(
                  f"Person {i+1}'s Persona: {p['persona']}"
              )
      else:
          personass_str_parts.append("__personas__")
          personass_str_parts.extend(
              [f"{p['name']}: {p['persona']}" for p in personas]
          )
          personass_str_parts.append("__end-personas__")
  
      return delim.join(personass_str_parts)
  
imports: from typing import Optional, Dict
  import random
  from parlai.core.agents import Agent
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from parlai.core.agents import create_agent_from_model_file
  from parlai.core.loader import load_agent_module
  from parlai.utils.logging import logging
label_desc: Use image node_id 1 for calling a global function with example usage: flatten_personas(personas, delim, bb3_format) and returns: delim