import itertools


def generate_jobs(entry):
    """
    Generate a list of job configurations by varying the parameters in the given entry.
    In practice, computes the cartesian product of all the lists at the toplevel of
    the input dictionary, and generates one job for each resulting instance.

    Args:
        entry (dict): Input job configurations

    Returns:
        list: List of jobs with list parameters replaced by actual values
    """
    keys = [k for k, v in entry.items() if isinstance(v, list)]
    all_vals = itertools.product(
        *[v for __, v in entry.items() if isinstance(v, list)])
    all_jobs = []
    for vals in all_vals:
        job = entry.copy()
        for k, v in zip(keys, vals):
            job[k] = v
        all_jobs.append(job)
    return all_jobs