docs: def pad(cls, sequences, padding, pad_len=None):
          """
          Pads a list of sequences such that they form a matrix.
  
          :param sequences: a list of sequences of varying lengths.
          :param padding: the value of padded cells.
          :param pad_len: the length of the maximum padded sequence.
          """
          max_len = max([len(s) for s in sequences])
          pad_len = pad_len or max_len
          assert pad_len >= max_len, 'pad_len {} must be greater or equal to the longest sequence {}'.format(pad_len, max_len)
          for i, s in enumerate(sequences):
              sequences[i] = [padding] * (pad_len - len(s)) + s
          return np.array(sequences)