code: def test_inmem_batched_dataloader_exit_without_hang(
      synthetic_dataset, reader_factory
  ):
      """
      See if InMemBatchedDataLoader would cause hang if not iterating.
      """
      for _ in range(5):
          with reader_factory(
              synthetic_dataset.url, schema_fields=["^id$"]
          ) as reader:
              with InMemBatchedDataLoader(reader) as _:
                  assert reader.stopped
  
imports: from decimal import Decimal
  from packaging import version
  import numpy
  import pyarrow
  import pytest
  import torch
  from petastorm import make_reader, TransformSpec, make_batch_reader
  from petastorm.pytorch import _sanitize_pytorch_types, DataLoader, BatchedDataLoader, decimal_friendly_collate, InMemBatchedDataLoader, _load_rows_into_mem
  from petastorm.tests.test_common import TestSchema
label_desc: Use image node_id 19 for calling a global function with example usage: test_inmem_batched_dataloader_exit_without_hang(synthetic_dataset, reader_factory) without return types