def METHOD_NAME(self, bufsize: int = 1, flags: int = 0) -> bytes:
    """Return chars from in memory buffer.
       Maintains the same API as socket.socket.recv.
    """
    if self._drain_thread is None:
        # Not buffering the socket, pass thru to socket.
        return socket.socket.METHOD_NAME(self, bufsize, flags)
    assert not flags, "Cannot pass flags to recv() in drained mode"
    start_time = time.time()
    while len(self._buffer) < bufsize:
        time.sleep(self._sleep_time)
        elapsed_sec = time.time() - start_time
        if elapsed_sec > self._recv_timeout_sec:
            raise socket.timeout
    return bytes((self._buffer.popleft() for i in range(bufsize)))