def METHOD_NAME(self, data: bytes) -> int:
    """Add data to buffer.
    Returns number of bytes added to buffer.
    """
    room_in_buffer = min(len(data), self._buffer_size - len(self._buffer))
    self._buffer += data[0:room_in_buffer]
    return room_in_buffer