def pack_apply_message(f, args, kwargs, threshold=64e-6):
    msg = [pickle.dumps(can(f),-1)]
    databuffers = [] # for large objects
    sargs, bufs = serialize_object(args,threshold)
    msg.append(sargs)
    databuffers.extend(bufs)
    skwargs, bufs = serialize_object(kwargs,threshold)
    msg.append(skwargs)
    databuffers.extend(bufs)
    msg.extend(databuffers)
    return msg
pack up a function, args, and kwargs to be sent over the wire
dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/util.py/pack_apply_message