def METHOD_NAME(self, item, encoded):
    # type: (Union[Snapshot, str], bytes) -> int
    try:
        with self._lock:
            size = self._buffer.put(encoded)
            self.count += 1
            return size
    except BufferFull:
        if self._on_full is not None:
            self._on_full(item, encoded)
        six.reraise(*sys.exc_info())