def _worker_fn(url, dataset_fn, sampler_fn):
    """Function to generate the dataset and sampler for each worker."""
    dataset = dataset_fn(url)
    sampler = sampler_fn(dataset)
    return (dataset, sampler)