def METHOD_NAME(self, size, timeout):
    buf = self._buf
    if self._read_reached_eof:
        # We have already finished reading. Use up any buffered data,
        # then raise EOF
        if buf:
            self._buf = buf[size:]
            return buf[:size]
        else:
            self.flag_eof = True
            raise EOF('End Of File (EOF).')
    if timeout == -1:
        timeout = self.timeout
    elif timeout is None:
        timeout = 1e6
    t0 = time.time()
    while (time.time() - t0) < timeout and size and len(buf) < size:
        try:
            incoming = self._read_queue.get_nowait()
        except Empty:
            break
        else:
            if incoming is None:
                self._read_reached_eof = True
                break
            buf += self._decoder.decode(incoming, final=False)
    r, self._buf = buf[:size], buf[size:]
    self._log(r, 'read')
    return r