code: def _generate_examples(tmp_dir, dataset_split):
      """Generate squad examples.
  
      Args:
        tmp_dir: a string
        dataset_split: problem.DatasetSplit.TRAIN or problem.DatasetSplit.EVAL
      Yields:
        dictionaries representing examples
      """
      if dataset_split == problem.DatasetSplit.TRAIN:
          file_name = _TRAINING_SET
      else:
          file_name = _DEV_SET
      squad_file = generator_utils.maybe_download(
          tmp_dir, file_name, os.path.join(_URL, file_name)
      )
      with tf.gfile.GFile(squad_file, mode="r") as fp:
          squad = json.load(fp)
  
      version = squad["version"]
      for article in squad["data"]:
          if "title" in article:
              title = article["title"].strip()
          else:
              title = "no title"
          for paragraph in article["paragraphs"]:
              context = paragraph["context"].strip()
              for qa in paragraph["qas"]:
                  question = qa["question"].strip()
                  id_ = qa["id"]
                  answer_starts = [
                      answer["answer_start"] for answer in qa["answers"]
                  ]
                  answers = [
                      answer["text"].strip() for answer in qa["answers"]
                  ]
  
                  # Features currently used are "context", "question", and "answers".
                  # Others are extracted here for the ease of future expansions.
                  example = {
                      "version": version,
                      "title": title,
                      "context": context,
                      "question": question,
                      "id": id_,
                      "answer_starts": answer_starts,
                      "answers": answers,
                      "num_answers": len(answers),
                      "is_supervised": True,
                  }
                  yield example
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import json
  import os
  from tensor2tensor.data_generators import generator_utils
  from tensor2tensor.data_generators import problem
  from tensor2tensor.data_generators import text_problems
  from tensor2tensor.data_generators import wiki_lm
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling a global function with example usage: _generate_examples(tmp_dir, dataset_split) without return types