def METHOD_NAME(data, include_topic, 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
                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