code: def pad_sentences(sentences, sentence_length=0, pad_val=0.0):
      """
      Pad all sentences to have the same length (number of words)
      """
      lengths = [len(sent) for sent in sentences]
  
      nsamples = len(sentences)
      if sentence_length == 0:
          sentence_length = np.max(lengths)
  
      X = (np.ones((nsamples, sentence_length)) * pad_val).astype(
          dtype=np.int32
      )
      for i, sent in enumerate(sentences):
          trunc = sent[-sentence_length:]
          X[i, : len(trunc)] = trunc
      return X
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import itertools
  import os
  import pickle
  import sys
  import tarfile
  import numpy
  from tqdm import tqdm
  from nlp_architect.utils.generic import license_prompt
  from nlp_architect.utils.io import download_unlicensed_file, valid_path_append
label_desc: Use image node_id 1 for calling a global function with example usage: pad_sentences(sentences, sentence_length, pad_val) and returns: X