def add_listeners(self, add_callback=None, remove_callback=None):
		with self.lock:
			if add_callback:
				get_logger().debug(
					"DistributedBag.add_listeners added add listener")
				self.add_callbacks.append(add_callback)
			if remove_callback:
				get_logger().debug(
					"DistributedBag.add_listeners added remove listener")
				self.delete_callbacks.append(remove_callback)
			return self.get_items()
Allows caller to add callbacks for item addition and item removal.
dataset/ETHPy150Open Knewton/pettingzoo-python/pettingzoo/dbag.py/DistributedBag.add_listeners