class_docstr: This class is used to control batch fetching flow.
  
  Args:
      prefetch_batches: Number of batches to pre-fetch. Pre-fetching at least 1 batch is necessary to properly track
          whether a batch is the last one (available with :attr:`self.done`) when the length is not available. The
          value of this argument is ignored when the length is available.
class_docstr_tok: ["This","class","is","used","to","control","batch","fetching","flow",".","Args",":","prefetch_batches",":","Number","of","batches","to","pre-fetch",".","Pre-fetching","at","least","1","batch","is","necessary","to","properly","track","whether","a","batch","is","the","last","one","(","available","with",":","attr",":","`","self.done","`",")","when","the","length","is","not","available",".","The","value","of","this","argument","is","ignored","when","the","length","is","available","."]
code: def __iter__(self) -> "_PrefetchDataFetcher":
      super().__iter__()
      if self.length is not None:
          # ignore pre-fetching, it's not necessary
          return self
      # prefetch batches to know when the iterator will be exhausted in advance
      for _ in range(self.prefetch_batches):
          try:
              batch = super().__next__()
              self.batches.append(batch)
          except StopIteration:
              # this would only happen when prefetch_batches > the number of batches available and makes
              # `__next__` jump directly to the empty iterator case without trying to fetch again
              break
      return self
  
imports: from typing import Any, Iterator, List, Optional
  from typing_extensions import override
  from lightning.fabric.utilities.data import sized_len
  from lightning.pytorch.utilities.combined_loader import _ITERATOR_RETURN, CombinedLoader
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
label_desc: Use image node_id 2 for calling the _PrefetchDataFetcher obj's underlying member method code with example usage: obj.__iter__() and returns: self, self