'recvpred(pred, timeout = default) -> str
Receives one byte at a time from the tube, until ``pred(bytes)``
evaluates to True.
If the request is not satisfied before ``timeout`` seconds pass,
all data is buffered and an empty string (``\'\'``) is returned.
Arguments:
pred(callable): Function to call, with the currently-accumulated data.
timeout(int): Timeout for the operation
Raises:
exceptions.EOFError: The connection is closed
Returns:
A string containing bytes received from the socket,
or ``\'\'`` if a timeout occurred while waiting.'

def recvpred(self, pred, timeout=default):

    data = ''
    with self.countdown(timeout):
        while (not pred(data)):
            try:
                res = self.recv(1)
            except Exception:
                self.unrecv(data)
                return ''
            if res:
                data += res
            else:
                self.unrecv(data)
                return ''
    return data
