class_docstr: A simple pool of BytesIO objects with a weak memory ceiling.
class_docstr_tok: ["A","simple","pool","of","BytesIO","objects","with","a","weak","memory","ceiling","."]
docstr: Create a new buffer pool.
  
  Arguments:
      memory (int): maximum memory that this buffer pool can allocate
      poolable_size (int): memory size per buffer to cache in the free
          list rather than deallocating
docstr_tok: ["Create","a","new","buffer","pool",".","Arguments",":","memory","(","int",")",":","maximum","memory","that","this","buffer","pool","can","allocate","poolable_size","(","int",")",":","memory","size","per","buffer","to","cache","in","the","free","list","rather","than","deallocating"]
code: def __init__(
      self,
      memory,
      poolable_size,
      metrics=None,
      metric_group_prefix="producer-metrics",
  ):
      """Create a new buffer pool.
  
      Arguments:
          memory (int): maximum memory that this buffer pool can allocate
          poolable_size (int): memory size per buffer to cache in the free
              list rather than deallocating
      """
      self._poolable_size = poolable_size
      self._lock = threading.RLock()
  
      buffers = int(memory / poolable_size) if poolable_size else 0
      self._free = collections.deque(
          [io.BytesIO() for _ in range(buffers)]
      )
  
      self._waiters = collections.deque()
      self.wait_time = None
      if metrics:
          self.wait_time = metrics.sensor("bufferpool-wait-time")
          self.wait_time.add(
              metrics.metric_name(
                  "bufferpool-wait-ratio",
                  metric_group_prefix,
                  "The fraction of time an appender waits for space allocation.",
              ),
              Rate(),
          )
  
file_path: kafka-python/kafka/producer/buffer.py
imports: from __future__ import absolute_import, division
  import collections
  import io
  import threading
  import time
  from kafka.metrics.stats import Rate
  import kafka.errors
label_desc: Use image node_id 1 to create a new SimpleBufferPool object from inherited base classes: object with example: obj = SimpleBufferPool(memory, poolable_size, metrics, metric_group_prefix)