def read(self):
        if self.closing:
            return ""

        while True:
            try:
                retval = self.queue.popleft()
                if self.cr.balance < 0:
                    self.cr.send(retval)

                if isinstance(retval, bomb):
                    retval.raise_()

                return retval
            except __HOLE__:
                pass

            msg = None
            buf = bytearray(DEFAULT_BUFFER_SIZE)
            try:
                recvd = recv_into(self.client, buf)
                msg =  bytes(buf[0:recvd])
            except socket.error:
                ex = sys.exc_info()[1]
                if ex.args[0] == EBADF:
                    msg = ""
                    self.closing = True
                if ex.args[0] != EWOULDBLOCK or self.timeout == 0.0:
                    msg = bomb(ex, sys.exc_info()[2])
                    self.closing = True
                exc_clear()

            if msg is None:
                res = self._watch_read()
                if res is not None:
                    self.queue.append(res)

            else:
                self.queue.append(msg)
dataset/ETHPy150Open benoitc/flower/flower/net/sock.py/SockConn.read