code: def get_data_array_squad(params_dict, data_train, set_val="train"):
      """
      Function to pad all sentences and restrict to max length defined by user
  
      Args:
      ---------
      params_dict: dictionary containing all input parameters
      data_train: list containing the training/dev data_train
      set_val: indicates id its a training set or dev set
  
      Returns:
      ----------
      Returns a list of tuples with padded sentences and masks
      """
  
      max_para = params_dict["max_para"]
      max_question = params_dict["max_question"]
      train_set = []
      count = 0
      for ele in data_train:
          para = ele[0]
          para_idx = ele[0]
  
          if len(para_idx) < max_para:
              pad_length = max_para - len(para_idx)
              para_idx = para_idx + [0] * pad_length
              para_len = len(para)
              para_mask = np.zeros([1, max_para])
              para_mask[0, 0 : len(para)] = 1
              para_mask = para_mask.tolist()[0]
  
              question_idx = ele[1]
              question = ele[1]
  
              if len(question) < max_question:
                  pad_length = max_question - len(question)
                  question_idx = question_idx + [0] * pad_length
                  question_len = len(question)
                  ques_mask = np.zeros([1, max_question])
                  ques_mask[0, 0:question_len] = 1
                  ques_mask = ques_mask.tolist()[0]
  
              train_set.append(
                  (
                      para_idx,
                      question_idx,
                      para_len,
                      question_len,
                      ele[2],
                      para_mask,
                      ques_mask,
                  )
              )
  
              if set_val == "train":
                  count += 1
                  if count >= params_dict["train_set_size"]:
                      break
      return train_set
  
imports: import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: get_data_array_squad(params_dict, data_train, set_val) and returns: train_set