def METHOD_NAME():
    def gen():
        return ({"i": i} for i in range(17))
    world_size = 2
    full_ds = IterableDataset.from_generator(gen)
    full_size = len(list(full_ds))
    ds_rank0 = split_dataset_by_node(full_ds, rank=0, world_size=world_size).shuffle(seed=42)
    assert len(list(ds_rank0)) == 1 + full_size // world_size
    with pytest.raises(RuntimeError):
        split_dataset_by_node(full_ds, rank=0, world_size=world_size).shuffle()
    ds_rank0 = split_dataset_by_node(full_ds.shuffle(seed=42), rank=0, world_size=world_size)
    assert len(list(ds_rank0)) == 1 + full_size // world_size
    with pytest.raises(RuntimeError):
        split_dataset_by_node(full_ds.shuffle(), rank=0, world_size=world_size)