code: def download_tydiqa_data_and_write_config(
      task_data_base_path: str, task_config_base_path: str
  ):
      tydiqa_temp_path = py_io.create_dir(
          task_data_base_path, "tydiqa_temp"
      )
      full_train_path = os.path.join(
          tydiqa_temp_path, "tydiqa-goldp-v1.1-train.json"
      )
      download_utils.download_file(
          "https://storage.googleapis.com/tydiqa/v1.1/tydiqa-goldp-v1.1-train.json",
          full_train_path,
      )
      download_utils.download_and_untar(
          "https://storage.googleapis.com/tydiqa/v1.1/tydiqa-goldp-v1.1-dev.tgz",
          tydiqa_temp_path,
      )
      languages_dict = {
          "arabic": "ar",
          "bengali": "bn",
          "english": "en",
          "finnish": "fi",
          "indonesian": "id",
          "korean": "ko",
          "russian": "ru",
          "swahili": "sw",
          "telugu": "te",
      }
  
      # Split train data
      data = py_io.read_json(full_train_path)
      lang2data = {lang: [] for lang in languages_dict.values()}
      for doc in data["data"]:
          for par in doc["paragraphs"]:
              context = par["context"]
              for qa in par["qas"]:
                  question = qa["question"]
                  question_id = qa["id"]
                  example_lang = languages_dict[
                      question_id.split("-")[0]
                  ]
                  q_id = question_id.split("-")[-1]
                  for answer in qa["answers"]:
                      a_start, a_text = (
                          answer["answer_start"],
                          answer["text"],
                      )
                      a_end = a_start + len(a_text)
                      assert context[a_start:a_end] == a_text
                  lang2data[example_lang].append(
                      {
                          "paragraphs": [
                              {
                                  "context": context,
                                  "qas": [
                                      {
                                          "answers": qa["answers"],
                                          "question": question,
                                          "id": q_id,
                                      }
                                  ],
                              }
                          ]
                      }
                  )
  
      for full_lang, lang in languages_dict.items():
          task_name = f"tydiqa_{lang}"
          task_data_path = py_io.create_dir(
              task_data_base_path, task_name
          )
          train_path = os.path.join(
              task_data_path, f"tydiqa.{lang}.train.json"
          )
          py_io.write_json(
              data=data,
              path=train_path,
          )
          val_path = os.path.join(
              task_data_path, f"tydiqa.{lang}.dev.json"
          )
          os.rename(
              src=os.path.join(
                  tydiqa_temp_path,
                  "tydiqa-goldp-v1.1-dev",
                  f"tydiqa-goldp-dev-{full_lang}.json",
              ),
              dst=val_path,
          )
          py_io.write_json(
              data={
                  "task": "tydiqa",
                  "paths": {"train": train_path, "val": val_path},
                  "kwargs": {"language": lang},
                  "name": task_name,
              },
              path=os.path.join(
                  task_config_base_path, f"{task_name}_config.json"
              ),
          )
      shutil.rmtree(tydiqa_temp_path)
  
imports: import copy
  import glob
  import itertools
  import os
  import shutil
  from pathlib import Path
  import jiant.scripts.download_data.utils
  import jiant.utils.display
  import jiant.utils.python.datastructures
  import jiant.utils.python.io
  import jiant.utils.python.filesystem
  import jiant.utils.python.strings
label_desc: Use image node_id 7 for calling a global function with example usage: download_tydiqa_data_and_write_config(task_data_base_path, task_config_base_path) without return types