code: def pad_sequence_into_array(
      Xs, maxlen=None, truncating="post", padding="post", value=0.0
  ):
      Nsamples = len(Xs)
      if maxlen is None:
          lengths = [
              s.shape[0] for s in Xs
          ]  # 'sequences' must be list, 's' must be numpy array, len(s) return the first dimension of s
          maxlen = np.max(lengths)
  
      Xout = np.ones(
          shape=[Nsamples, maxlen] + list(Xs[0].shape[1:]),
          dtype=Xs[0].dtype,
      ) * np.asarray(value, dtype=Xs[0].dtype)
      Mask = np.zeros(shape=[Nsamples, maxlen], dtype=Xout.dtype)
      for i in range(Nsamples):
          x = Xs[i]
          if truncating == "pre":
              trunc = x[-maxlen:]
          elif truncating == "post":
              trunc = x[:maxlen]
          else:
              raise ValueError(
                  "Truncating type '%s' not understood" % truncating
              )
          if padding == "post":
              Xout[i, : len(trunc)] = trunc
              Mask[i, : len(trunc)] = 1
          elif padding == "pre":
              Xout[i, -len(trunc) :] = trunc
              Mask[i, -len(trunc) :] = 1
          else:
              raise ValueError(
                  "Padding type '%s' not understood" % padding
              )
      return Xout, Mask
  
file_path: delta/egs/iemocap/emo/v1/local/python/helper.py
imports: import os
  import csv
  import wave
  import sys
  import numpy
  import pandas
  import glob
  from tensorflow.keras.preprocessing.text import text_to_word_sequence
label_desc: Use image node_id 3 for calling a global function with example usage: pad_sequence_into_array(Xs, maxlen, truncating, padding, value) and returns: Xout,  Mask