class_docstr: Basic in-memory dict-based object for saving Task Records.
  
  This is the first object to present the DB interface
  for logging tasks out of memory.
  
  The interface is based on MongoDB, so adding a MongoDB
  backend should be straightforward.
code: def _maybe_cull(self):
      # cull by count:
      if len(self._records) > self.record_limit:
          to_cull = int(self.cull_fraction * self.record_limit)
          self.log.info(
              "%i records exceeds limit of %i, culling oldest %i",
              len(self._records),
              self.record_limit,
              to_cull,
          )
          self._cull_oldest(to_cull)
  
      # cull by size:
      if self._buffer_bytes > self.size_limit:
          limit = self.size_limit * (1 - self.cull_fraction)
  
          before = self._buffer_bytes
          before_count = len(self._records)
          culled = 0
          while self._buffer_bytes > limit:
              self._cull_oldest(1)
              culled += 1
  
          self.log.info(
              "%i records with total buffer size %i exceeds limit: %i. Culled oldest %i records.",
              before_count,
              before,
              self.size_limit,
              culled,
          )
  
imports: import copy
  from copy import deepcopy
  from datetime import datetime
  from traitlets import Dict, Float, Integer, Unicode
  from traitlets.config.configurable import LoggingConfigurable
  from ..util import ensure_timezone
label_desc: Use image node_id 7 for calling the DictDB obj's underlying member method code with example usage: obj._maybe_cull() without return types