code: def pre_process(fname, num_ex, alt_speaker):
      """
      Pre-process the given file to bring the conversation in a certain format.
  
      :param fname: File name to be processed
      :param num_ex: Number of conversations to be used
      :param alt_speaker: Name of other speaker to be used
  
      :return: List of tuples of the form: (speaker, speech)
      """
      conversation = []
      with PathManager.open(fname) as f:
          lines = f.readlines()
          random.shuffle(lines)
          lines = lines[:num_ex]
          for line in lines:
              data = json.loads(line)
              dialogue = data["dialog"]
              for item in dialogue:
                  speaker = item[0]["id"]
                  text = item[0]["text"]
                  conversation += [(speaker, text)]
              conversation += [(END_OF_CONVO, END_OF_CONVO)]
  
      return conversation
  
imports: import os
  import json
  import random
  import tempfile
  import subprocess
  from parlai.core.params import ParlaiParser
  from parlai.core.script import ParlaiScript, register_script
  from parlai.utils.io import PathManager
label_desc: Use image node_id 3 for calling a global function with example usage: pre_process(fname, num_ex, alt_speaker) and returns: conversation