def METHOD_NAME(self, count, timeout=RECV_TIMEOUT_DEFAULT):
    """Ensure to read count bytes from the socket"""
    data = b""
    old_timeout = self.socket.gettimeout()
    if timeout is not RECV_TIMEOUT_DEFAULT:
        self.socket.settimeout(timeout)
    try:
        while len(data) < count:
            buf = self.socket.recv(count - len(data))
            self.socket.settimeout(None)
            if not buf:
                raise socket.error('Connection closed')
            data += buf
    finally:
        self.socket.settimeout(old_timeout)
    return data