code: def get_squad_examples(data_dir, segment="train", version="1.1"):
      """
  
      Parameters
      ----------
      data_dir
          The directory of the data
      segment
          The segment
      version
          Version of the SQuAD
  
      Returns
      -------
      examples
          A list of SquadExampls objects
      """
      if version == "1.1":
          train_path = os.path.join(data_dir, "train-v1.1.json")
          dev_path = os.path.join(data_dir, "dev-v1.1.json")
      elif version == "2.0":
          train_path = os.path.join(data_dir, "train-v2.0.json")
          dev_path = os.path.join(data_dir, "dev-v2.0.json")
      else:
          raise NotImplementedError
  
      if segment == "train":
          examples = get_squad_examples_from_json(
              train_path, is_training=True
          )
      elif segment == "dev":
          examples = get_squad_examples_from_json(
              dev_path, is_training=False
          )
      else:
          raise NotImplementedError
  
      return examples
  
imports: from typing import Optional, List, Tuple
  from collections import namedtuple
  import dataclasses
  from dataclasses import dataclass
  import re
  import numpy
  import warnings
  import os
  from tqdm.auto import tqdm
  import json
  import string
  from gluonnlp.data.tokenizers import BaseTokenizerWithVocab
  from gluonnlp.utils.preprocessing import match_tokens_with_char_spans
  from mxnet.gluon.utils import download
  import mxnet
label_desc: Use image node_id 4 for calling a global function with example usage: get_squad_examples(data_dir, segment, version) and returns: examples