code: def test_get_shard_optimized(ray_start_regular_shared):
      it = from_range(6, num_shards=3)
      shard1 = it.get_shard(shard_index=0, batch_ms=25, num_async=2)
      shard2 = it.get_shard(shard_index=1, batch_ms=15, num_async=3)
      shard3 = it.get_shard(shard_index=2, batch_ms=5, num_async=4)
      assert list(shard1) == [0, 1]
      assert list(shard2) == [2, 3]
      assert list(shard3) == [4, 5]
  
imports: import sys
  import time
  import collections
  from collections import Counter
  import pytest
  import ray
  from ray.util.iter import from_items, from_iterators, from_range, from_actors, ParallelIteratorWorker, LocalIterator
  from ray._private.test_utils import Semaphore
label_desc: Use image node_id 28 for calling a global function with example usage: test_get_shard_optimized(ray_start_regular_shared) without return types