def new_kfold(k, train_df, test_df):
    """
    Returns indices for training, validation, and testing data for the load_from_ids function
    Args:
        k - (int) Number of folds
        train_df - (df) dataframe with the training data and the fold number of each sample
        test_df - (df) dataframe with the test data and the fold number of each sample
    Returns:
        train - (list)
        validation - (list)
        test - (list)
    """

    folds = []
    for i in range(k):
        folds.append([])
    for index, row in train_df.iterrows():
        folds[row['fold'] - 1].append(index)
    for index, row in test_df.iterrows():
        folds[k - 1].append(index + len(train_df['id']))

    train = []
    validation = []
    test = []
    testfold = k - 1
    for i in range(k - 1):
        validation.append(folds[i])
        test.append(folds[testfold])
        train_fold = []
        for x in range(k - 1):
            if x != i and x != testfold:
                train_fold += folds[x]
        train.append(train_fold)

    train.append(train[-1] + validation[-1])
    validation.append(test[-1])
    test.append(test[-1])
    return train, validation, test