def fill_hyper_q(hyps, hyp_ranges, keys, hyper_q, idx=0):
    """
    Recursive function to load each of the hyperparameter combinations
    onto a queue.

    hyps - dict of hyperparameters created by a HyperParameters object
        type: dict
        keys: name of hyperparameter
        values: value of hyperparameter
    hyp_ranges - dict of lists
        these are the ranges that will change the hyperparameters for
        each search
        type: dict
        keys: name of hyperparameters to be searched over
        values: list of values to search over for that hyperparameter
    keys - keys of the hyperparameters to be searched over. Used to
        specify order of keys to search
    hyper_q - Queue to hold all parameter sets
    idx - the index of the current key to be searched over

    Returns:
        hyper_q: Queue of dicts `hyps`
    """
    # Base call, saves the hyperparameter combination
    if idx >= len(keys):
        # Load q
        hyps['search_keys'] = ""
        for k in keys:
            if isinstance(hyp_ranges[k],dict):
                for rk in hyp_ranges[k].keys():
                    hyps['search_keys'] += "_" + str(rk)+str(hyps[rk])
            else:
                hyps['search_keys'] += "_" + str(k)+str(hyps[k])
        hyper_q.put({**hyps})

    # Non-base call. Sets a hyperparameter to a new search value and
    # passes down the dict.
    else:
        key = keys[idx]
        # Allows us to specify combinations of hyperparameters
        if isinstance(hyp_ranges[key],dict):
            rkeys = list(hyp_ranges[key].keys())
            for i in range(len(hyp_ranges[key][rkeys[0]])):
                for rkey in rkeys:
                    hyps[rkey] = hyp_ranges[key][rkey][i]
                hyper_q = fill_hyper_q(hyps, hyp_ranges, keys, hyper_q,
                                                               idx+1)
        else:
            for param in hyp_ranges[key]:
                hyps[key] = param
                hyper_q = fill_hyper_q(hyps, hyp_ranges, keys, hyper_q,
                                                               idx+1)
    return hyper_q