The multiprocessing implementation of the partially-Pickling "ppmap"
        function. This doesn't use a Pool like map() does, because the whole
        problem is that Pool chokes on un-Pickle-able values. Strongly derived
        from code posted on StackExchange by "klaus se":
        `<http://stackoverflow.com/a/16071616/3760486>`_.

        This implementation could definitely be improved -- that's basically
        what the Pool class is all about -- but this gets us off the ground
        for those cases where the Pickle limitation is important.

        XXX This deadlocks if a child process crashes!!! XXX

def _ppmap(self, func, fixed_arg, var_arg_iter):
        """The multiprocessing implementation of the partially-Pickling "ppmap"
        function. This doesn't use a Pool like map() does, because the whole
        problem is that Pool chokes on un-Pickle-able values. Strongly derived
        from code posted on StackExchange by "klaus se":
        `<http://stackoverflow.com/a/16071616/3760486>`_.

        This implementation could definitely be improved -- that's basically
        what the Pool class is all about -- but this gets us off the ground
        for those cases where the Pickle limitation is important.

        XXX This deadlocks if a child process crashes!!! XXX
        """
        n_procs = self.pool_kwargs.get('processes')
        if n_procs is None:
            # Logic copied from multiprocessing.pool.Pool.__init__()
            try:
                from multiprocessing import cpu_count
                n_procs = cpu_count()
            except NotImplementedError:
                n_procs = 1

        in_queue = Queue(1)
        out_queue = Queue()
        procs = [Process(target=multiprocessing_ppmap_worker,
                         args=(in_queue, out_queue, func, fixed_arg))
                 for _ in range(n_procs)]

        for p in procs:
            p.daemon = True
            p.start()

        i = -1

        for i, var_arg in enumerate(var_arg_iter):
            in_queue.put((i, var_arg))

        n_items = i + 1
        result = [None] * n_items

        for p in procs:
            in_queue.put((None, None))

        for _ in range(n_items):
            i, value = out_queue.get()
            result[i] = value

        for p in procs:
            p.join()

        return result