def get_sweep_parameters(parameters, env_config, index):
    """
    Gets the parameters for the hyperparameter sweep defined by the index.

    Each hyperparameter setting has a specific index number, and this function
    will get the appropriate parameters for the argument index. In addition,
    this the indices will wrap around, so if there are a total of 10 different
    hyperparameter settings, then the indices 0 and 10 will return the same
    hyperparameter settings. This is useful for performing loops.

    For example, if you had 10 hyperparameter settings and you wanted to do
    10 runs, the you could just call this for indices in range(0, 10*10). If
    you only wanted to do runs for hyperparameter setting i, then you would
    use indices in range(i, 10, 10*10)

    Parameters
    ----------
    parameters : dict
        The dictionary of parameters, as found in the agent's json
        configuration file
    env_config : dict
        The environment configuration dictionary, as found in the environment's
        json configuration file
    index : int
        The index of the hyperparameters configuration to return

    Returns
    -------
    dict, int
        The dictionary of hyperparameters to use for the agent and the total
        number of combinations of hyperparameters (highest possible unique
        index)
    """
    out_params = {}
    out_params["gamma"] = env_config["gamma"]
    accum = 1
    for key in parameters:
        num = len(parameters[key])
        out_params[key] = parameters[key][(index // accum) % num]
        accum *= num
    return (out_params, accum)