def send_array(<EOL>socket, A=None, metadata=None, flags=<NUM_LIT:0>,<EOL>copy=False, track=False, compress=None,<EOL>chunksize=<NUM_LIT:50> * <NUM_LIT:1000> * <NUM_LIT:1000><EOL>):
<EOL>md = {}<EOL>md['<STR_LIT>'] = datetime.datetime.now().isoformat()<EOL>if metadata:<EOL><INDENT>md.update(metadata)<EOL><DEDENT>if A is None:<EOL><INDENT>md['<STR_LIT>'] = <NUM_LIT:0><EOL>socket.send_json(md, flags)<EOL>return<EOL><DEDENT>if isinstance(A, float) or isinstance(A, int):<EOL><INDENT>A = np.asarray(A)<EOL><DEDENT>md['<STR_LIT>'] = str(A.dtype)<EOL>md['<STR_LIT>'] = A.shape<EOL>md['<STR_LIT>'] = int(np.prod(A.shape) // chunksize + <NUM_LIT:1>)<EOL>try:<EOL><INDENT>md['<STR_LIT>'] = np.asscalar(A.fill_value)<EOL>A = A.filled()<EOL><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT>socket.send_json(md, flags | zmq.SNDMORE)<EOL>if md['<STR_LIT>'] == <NUM_LIT:1>:<EOL><INDENT>msg = memoryview(np.ascontiguousarray(A))<EOL>socket.send(msg, flags, copy=copy, track=track)<EOL><DEDENT>else:<EOL><INDENT>for i, a in enumerate(np.array_split(A, md['<STR_LIT>'])):<EOL><INDENT>msg = memoryview(np.ascontiguousarray(a))<EOL>flags_ = flags<EOL>if i != md['<STR_LIT>'] - <NUM_LIT:1>:<EOL><INDENT>flags_ |= zmq.SNDMORE<EOL><DEDENT>socket.send(msg, flags_, copy=copy, track=track)<EOL><DEDENT><DEDENT>return<EOL>
send a numpy array with metadata over zmq

    message is mostly multipart:
    metadata | array part 1 | array part 2, etc

    only metadata:
    metadata

    the chunksize roughly determines the size of the parts being sent
    if the chunksize is too big, you get an error like:
        zmq.error.Again: Resource temporarily unavailable