human
Complete the below
def gridsearch(Classifier, documents=[], folds=10, **kwargs):

    ''''Returns the test results for every combination of optional parameters,
    using K-fold cross-validation for the given classifier (NB, KNN, SLP, SVM).
    For example:
    for (A, P, R, F, o), p in gridsearch(SVM, data, c=[0.1, 1, 10]):
    print((A, P, R, F, o), p)
    > (0.919, 0.921, 0.919, 0.920), {"c": 10}
    > (0.874, 0.884, 0.865, 0.874), {"c": 1}
    > (0.535, 0.424, 0.551, 0.454), {"c": 0.1}'
    '''

=====
Write me a the Python program you requested?
assistant
#Here is the Python program you requested.
    def product(*args):
        p = [[]]
        for iterable in args:
            p = [(x + [y]) for x in p for y in iterable]
        for p in p:
            (yield tuple(p))
    s = []
    p = []
    for (k, v) in kwargs.items():
        p.append([(k, v) for v in v])
    for p in product(*p):
        p = dict(p)
        s.append((K_fold_cross_validation(Classifier, documents, folds, **p), p))
    return sorted(s, reverse=True)