class_docstr: Base class to enqueue inputs.
  
  The task of an Enqueuer is to use parallelism to speed up preprocessing.
  This is done with processes or threads.
  
  Example:
  
  ```python
      enqueuer = PyDatasetEnqueuer(...)
      enqueuer.start()
      datas = enqueuer.get()
      for data in datas:
          # Use the inputs; training, evaluating, predicting.
          # ... stop sometime.
      enqueuer.stop()
  ```
  
  The `enqueuer.get()` should be an infinite stream of data.
docstr: Stops running threads and wait for them to exit, if necessary.
  
  Should be called by the same thread which called `start()`.
  
  Args:
      timeout: maximum time to wait on `thread.join()`
docstr_tok: ["Stops","running","threads","and","wait","for","them","to","exit",",","if","necessary",".","Should","be","called","by","the","same","thread","which","called","`","start","(",")","`",".","Args",":","timeout",":","maximum","time","to","wait","on","`","thread.join","(",")","`"]
code: def stop(self, timeout=None):
      """Stops running threads and wait for them to exit, if necessary.
  
      Should be called by the same thread which called `start()`.
  
      Args:
          timeout: maximum time to wait on `thread.join()`
      """
      if not self.is_running():
          return
      self.stop_signal.set()
      with self.queue.mutex:
          self.queue.queue.clear()
          self.queue.unfinished_tasks = 0
          self.queue.not_full.notify()
      self.run_thread.join(timeout)
      _SHARED_SEQUENCES[self.uid] = None
  
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 5 for calling the PyDatasetEnqueuer obj's underlying member method code with example usage: obj.stop(timeout) without return types