code: def __iter__(self):
      if self._error is not None:
          raise RuntimeError(
              "Cannot start a new iteration because last time iteration failed with error {err}.".format(
                  err=repr(self._error)
              )
          )
      if (
          self._in_iter is not None and self._in_iter == True
      ):  # noqa: E712
          raise RuntimeError(_PARALLEL_ITER_ERROR)
      if self._in_iter is not None:
          self.reader.reset()
          logger.warning(
              "Start a new pass of Petastorm DataLoader, reset underlying Petastorm reader to position 0."
          )
      self._in_iter = True
  
      try:
          for batch in self._iter_impl():
              yield batch
      except Exception as e:
          self._error = e
          logger.error(
              "Iteration on Petastorm DataLoader raise error: %s",
              repr(e),
          )
          raise
      finally:
          self._in_iter = False
  
imports: import collections.abc
  import decimal
  import re
  import logging
  import numpy
  from six import PY2
  from torch.utils.data.dataloader import default_collate
  import torch
  from packaging import version
  from petastorm.reader_impl.shuffling_buffer import RandomShufflingBuffer, NoopShufflingBuffer
  from petastorm.reader_impl.pytorch_shuffling_buffer import BatchedRandomShufflingBuffer, BatchedNoopShufflingBuffer
label_desc: Use image node_id 2 for calling the LoaderBase obj's underlying member method code with example usage: obj.__iter__() without return types