'call recv[_multipart] in a way that raises if there is nothing to receive'

def _select_recv(self, multipart, socket, **kwargs):

    if (zmq.zmq_version_info() >= (3, 1, 0)):
        time.sleep(0.1)
    (r, w, x) = zmq.select([socket], [], [], timeout=5)
    assert (len(r) > 0), 'Should    have    received    a    message'
    kwargs['flags'] = (zmq.DONTWAIT | kwargs.get('flags', 0))
    recv = (socket.recv_multipart if multipart else socket.recv)
    return recv(**kwargs)
