code: def test_sharded_parallel_sample_iter_num_batches():
      num_shards = 2
      batch_size = 2
      num_batches_per_bucket = 10
      buckets = data_io.define_parallel_buckets(100, 100, 10, True, 1.0)
      bucket_counts = [
          batch_size * num_batches_per_bucket for _ in buckets
      ]
      num_batches_per_shard = num_batches_per_bucket * len(buckets)
      num_batches = num_shards * num_batches_per_shard
      bucket_batch_sizes = data_io.define_bucket_batch_sizes(
          buckets,
          batch_size,
          batch_type=C.BATCH_TYPE_SENTENCE,
          data_target_average_len=[None] * len(buckets),
      )
  
      dataset1 = data_io.ParallelDataSet(
          *_get_random_bucketed_data(
              buckets,
              min_count=0,
              max_count=5,
              bucket_counts=bucket_counts,
          )
      )
      dataset2 = data_io.ParallelDataSet(
          *_get_random_bucketed_data(
              buckets,
              min_count=0,
              max_count=5,
              bucket_counts=bucket_counts,
          )
      )
      with TemporaryDirectory() as work_dir:
          shard1_fname = os.path.join(work_dir, "shard1")
          shard2_fname = os.path.join(work_dir, "shard2")
          dataset1.save(shard1_fname)
          dataset2.save(shard2_fname)
          shard_fnames = [shard1_fname, shard2_fname]
  
          it = data_io.ShardedParallelSampleIter(
              shard_fnames, buckets, batch_size, bucket_batch_sizes
          )
  
          num_batches_seen = 0
          while it.iter_next():
              it.next()
              num_batches_seen += 1
          assert num_batches_seen == num_batches
  
imports: import os
  import random
  from tempfile import TemporaryDirectory
  from typing import Optional, List, Tuple
  import numpy
  import pytest
  import torch
  from sockeye import constants
  from sockeye import data_io
  from sockeye import utils
  from sockeye import vocab
  from sockeye.test_utils import tmp_digits_dataset
  from sockeye.utils import SockeyeError, get_tokens, seed_rngs
label_desc: Use image node_id 27 for calling a global function with example usage: test_sharded_parallel_sample_iter_num_batches() without return types