<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate_folds(node_label_matrix, labelled_node_indices, number_of_categories, percentage, number_of_folds=10):
 """ Form the seed nodes for training and testing. Inputs: - node_label_matrix: The node-label ground truth in a SciPy sparse matrix format. - labelled_node_indices: A NumPy array containing the labelled node indices. - number_of_categories: The number of categories/classes in the learning. - percentage: The percentage of labelled samples that will be used for training. Output: - folds: A generator containing train/test set folds. """

    number_of_labeled_nodes = labelled_node_indices.size
    training_set_size = int(np.ceil(percentage*number_of_labeled_nodes/100))

    ####################################################################################################################
    # Generate folds
    ####################################################################################################################
    train_list = list()
    test_list = list()
    for trial in np.arange(number_of_folds):
        train, test = valid_train_test(node_label_matrix[labelled_node_indices, :],
                                       training_set_size,
                                       number_of_categories,
                                       trial)
        train = labelled_node_indices[train]
        test = labelled_node_indices[test]

        train_list.append(train)
        test_list.append(test)

    folds = ((train, test) for train, test in zip(train_list, test_list))
    return folds