def recv_array(
        socket,
        flags=0,
        copy=False,
        track=False,
        poll=None,
        poll_timeout=10000
):
    if poll is None:
        md = socket.recv_json(flags=flags)
    else:
        socks = dict(poll.poll(poll_timeout))
        if socks.get(socket) == zmq.POLLIN:
            reply = socket.recv_json(flags=flags)
            md = reply
        else:
            raise NoResponseException(
                "Recv_array got no response within timeout (1)")
    if md['parts'] == 0:
        A = None
    elif md['parts'] == 1:
        if poll is None:
            msg = socket.recv(flags=flags, copy=copy, track=track)
        else:
            socks = dict(poll.poll(poll_timeout))
            if socks.get(socket) == zmq.POLLIN:
                reply = socket.recv(flags=flags, copy=copy, track=track)
                msg = reply
            else:
                raise NoResponseException(
                    "Recv_array got no response within timeout (2)")
        buf = buffer(msg)
        A = np.frombuffer(buf, dtype=md['dtype'])
        A = A.reshape(md['shape'])
        if 'fill_value' in md:
            A = np.ma.masked_equal(A, md['fill_value'])
    else:
        A = np.zeros(np.prod(md['shape']), dtype=md['dtype'])
        arr_position = 0
        for i in range(md['parts']):
            if poll is None:
                msg = socket.recv(flags=flags, copy=copy, track=track)
            else:
                socks = dict(poll.poll(poll_timeout))
                if socks.get(socket) == zmq.POLLIN:
                    reply = socket.recv(flags=flags, copy=copy, track=track)
                    if not reply:
                        raise EmptyResponseException(
                            "Recv_array got an empty response (2)")
                    msg = reply
                else:
                    raise NoResponseException(
                        "Recv_array got no response within timeout (2)")
            buf = buffer(msg)
            a = np.frombuffer(buf, dtype=md['dtype'])
            A[arr_position:arr_position + a.shape[0]] = a[:]
            arr_position += a.shape[0]
        A = A.reshape(md['shape'])
        if 'fill_value' in md:
            A = np.ma.masked_equal(A, md['fill_value'])
    return A, md