code: def prepare_data(seqs, labels, maxlen=None):
      """Create the matrices from the datasets.
      This pad each sequence to the same lenght: the lenght of the
      longuest sequence or maxlen.
      if maxlen is set, we will cut all sequence to this maximum
      lenght.
      This swap the axis!
      """
      # x: a list of sentences
      lengths = [len(s) for s in seqs]
  
      if maxlen is not None:
          new_seqs = []
          new_labels = []
          new_lengths = []
          for l, s, y in zip(lengths, seqs, labels):
              if l < maxlen:
                  new_seqs.append(s)
                  new_labels.append(y)
                  new_lengths.append(l)
          lengths = new_lengths
          labels = new_labels
          seqs = new_seqs
  
          if len(lengths) < 1:
              return None, None, None
  
      n_samples = len(seqs)
      maxlen = numpy.max(lengths)
  
      x = numpy.zeros((maxlen, n_samples)).astype("int64")
      x_mask = numpy.zeros((maxlen, n_samples)).astype(tf.float32)
      for idx, s in enumerate(seqs):
          x[: lengths[idx], idx] = s
          x_mask[: lengths[idx], idx] = 1.0
  
      return x, x_mask, labels
  
file_path: tflearn/tflearn/datasets/imdb.py
imports: from __future__ import print_function
  import six.moves.cPickle
  import gzip
  import os
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_data(seqs, labels, maxlen) and returns: x,  x_mask,  labels, None,  None,  None