def METHOD_NAME(self, size: int, timeout: float = 10, timeout_is_soft: bool = False) -> bytes:
    if timeout == 0:
        if timeout_is_soft:
            return b""
        else:
            raise ReadingTimeoutError(read_bytes=b"")
    timer = TimeHelper(timeout)
    while len(self._read_buffer) < size:
        self.check_for_error()
        try:
            self._read_buffer.extend(self._read_queue.get(True, timer.time_left))
        except queue.Empty as e:
            if timeout_is_soft:
                return b""
            else:
                logger.error(
                    "Could not read expected %s bytes in %s seconds. Bytes read: %r",
                    size,
                    timeout,
                    self._read_buffer,
                )
                raise ReadingTimeoutError(read_bytes=self._read_buffer) from e
    try:
        data = self._read_buffer[:size]
        return data
    finally:
        del self._read_buffer[:size]