class_docstr: Adapter for `keras.utils.PyDataset` instances.
code: def _standardize_batch(self, batch):
      if isinstance(batch, dict):
          return batch
      if isinstance(batch, np.ndarray):
          batch = (batch,)
      if isinstance(batch, list):
          batch = tuple(batch)
      if not isinstance(batch, tuple) or len(batch) not in {1, 2, 3}:
          raise ValueError(
              "PyDataset.__getitem__() must return a tuple or a dict. "
              "If a tuple, it must be ordered either "
              "(input,) or (inputs, targets) or "
              "(inputs, targets, sample_weights). "
              f"Received: {str(batch)[:100]}... of type {type(batch)}"
          )
      if self.class_weight is not None:
          if len(batch) == 3:
              raise ValueError(
                  "You cannot specify `class_weight` "
                  "and `sample_weight` at the same time."
              )
          if len(batch) == 2:
              sw = data_adapter_utils.class_weight_to_sample_weights(
                  batch[1], self.class_weight
              )
              batch = batch + (sw,)
      return batch
  
imports: import multiprocessing.dummy
  import queue
  import random
  import threading
  import time
  import warnings
  import weakref
  from contextlib import closing
  import numpy
  import tree
  from keras.api_export import keras_export
  from keras.trainers.data_adapters import data_adapter_utils
  from keras.trainers.data_adapters.data_adapter import DataAdapter
label_desc: Use image node_id 3 for calling the PyDatasetAdapter obj's underlying member method code with example usage: obj._standardize_batch(batch) and returns: batch, batch