def next_batch(X, y, counter, batch_size):
    """ Returns the next batch from the preprocessed data

    Args:
    X: EEG input data of size [batch_size, window_length, electrodes]
    y: lables, size [batch_size]
    counter (int): the batch number
    
    Returns:
    batch of data and corresponding lables
    """

    start_index = counter * batch_size
    end_index = start_index + batch_size
    if end_index > X.shape[0]:
        end_index = X.shape[0]
    return X[start_index: end_index], y[start_index: end_index]