import itertools


def prep_args(otu_sizes=None, sample_sizes=None, reps=1, densities=None):
    """
    Generates (otu_size, sample_size, density, rep_number, seed) pairs
    """
    if otu_sizes is None:
        otu_sizes = [None]
    if sample_sizes is None:
        sample_sizes = [None]
    if densities is None:
        densities = [None]

    total_subsets = len(densities)*len(otu_sizes)*len(sample_sizes)*reps
    sizes = total_subsets * reps
    size_combs = list(itertools.product(otu_sizes, sample_sizes, densities))
    size_reps = [(*size_comb, i) for i in range(reps) for
                 size_comb in size_combs]
    seeds = range(total_subsets)

    sizes_with_seeds = [(*size_reps[seed], seed) for seed in seeds]
    return sizes_with_seeds