def pad_trunc(data, maxlen):
    ' For a given dataset pad with zero vectors or truncate to maxlen '
    new_data = []
    zero_vector = []
    for _ in range(len(data[0][0])):
        zero_vector.append(0.0)
    for sample in data:
        if (len(sample) > maxlen):
            temp = sample[:maxlen]
        elif (len(sample) < maxlen):
            temp = sample
            additional_elems = (maxlen - len(sample))
            for _ in range(additional_elems):
                temp.append(zero_vector)
        else:
            temp = sample
        new_data.append(temp)
    return new_data
For a given dataset pad with zero vectors or truncate to maxlen
def pad_trunc(data, maxlen):
    '  '
    new_data = []
    zero_vector = []
    for _ in range(len(data[0][0])):
        zero_vector.append(0.0)
    for sample in data:
        if (len(sample) > maxlen):
            temp = sample[:maxlen]
        elif (len(sample) < maxlen):
            temp = sample
            additional_elems = (maxlen - len(sample))
            for _ in range(additional_elems):
                temp.append(zero_vector)
        else:
            temp = sample
        new_data.append(temp)
    return new_data