def make_sparselist(vals, total, filler=0):
    """Generate a sparse list with a given set of values.

    Args:
        vals (dict) - the list of indices and values,
            where the key value represents the index to fill in
        total (int) - the total length of the list. A length less than the
            length of len(keys.values()) will throw a ValueError

    Returns:
        sparselist (list) - the sparselist.
    """
    if len(vals.keys()) > 0:
        if max(vals.keys()) < total:
            raise ValueError(
                'Invalid length. Keys must be less than or equal to total.')
    _sparselist = [filler for _ in range(total)]
    for index, value in vals.iteritems():
        _sparselist[index] = value
    return _sparselist
dataset/ETHPy150Open christabor/MoAL/MOAL/helpers/datamaker.py/make_sparselist/swapped operands of `<`