def dataIterator(data, batchSize=batchSize):
    for patient_data in data:
        for n in range(0, len(patient_data), batchSize):
            yield patient_data[n:n + batchSize]
Creating a generator from list of sequences for RNN