def _producer_wrapper(f, port, addr='tcp://127.0.0.1'):
    try:
        context = zmq.Context()
        socket = context.socket(zmq.PUSH)
        socket.connect(':'.join([addr, str(port)]))
        f(socket)
    finally:
        # Works around a Python 3.x bug.
        context.destroy()
A shim that sets up a socket and starts the producer callable.
dataset/ETHPy150Open mila-udem/fuel/fuel/utils/parallel.py/_producer_wrapper