def kv_iter(ds):
    """ Iterator for key-value structure, list and dict """
    if isinstance(ds, list):
        return enumerate(ds)
    elif isinstance(ds, dict):
        return iter(ds.items())
    else:
        raise ValueError(type(ds))