code: def extract_questions(data, include_topic, sft_format, split):
      processed_data = []
  
      # Iterate over topics, want to keep them seprate in train/val/test splits
      for question_group in data:
          processed_topic_data = []
          topic = question_group["title"]
          questions = question_group["paragraphs"]
  
          # Iterate over paragraphs related to topics
          for qa_group in questions:
              context = qa_group["context"]
              qas = qa_group["qas"]
  
              # Iterate over questions about paragraph
              for qa in qas:
                  question = qa["question"]
  
                  try:
                      # Dev set has multiple right answers. Want all possible answers in test split ground truth
                      if split == "test":
                          answers = [
                              qa["answers"][i]["text"]
                              for i in range(len(qa["answers"]))
                          ]
  
                      # Choose one anser from dev set if making validation split, train set only has one answer
                      else:
                          answers = qa["answers"][0]["text"]
  
                  except IndexError:
                      continue
  
                  if sft_format:
                      example_json = {
                          "input": f"User: Context:{context} Question:{question}\n\nAssistant:",
                          "output": answers,
                      }
                  else:
                      example_json = {
                          "taskname": "squad",
                          "context": context,
                          "question": question,
                          "answer": answers,
                      }
  
                  if include_topic:
                      example_json["topic"] = topic
  
                  processed_topic_data.append(example_json)
          processed_data.extend(processed_topic_data)
  
      return processed_data
  
imports: import argparse
  import json
  from tqdm import tqdm
label_desc: Use image node_id 3 for calling a global function with example usage: extract_questions(data, include_topic, sft_format, split) and returns: processed_data