def fun(f, q_in, q_out):
    """
    A helper function for the parmap function.

    Parameters
    ----------
    f : function
        Function to be evaluated using arguments in the queue q_in.
    q_in : multiprocessing Queue object
        A queue for the input arguments.
    q_out : multiprocessing Queue object
        A queue for the output of the function evaluation.
    """
    while True:
        i, x = q_in.get()
        if i is None:
            break
        q_out.put((i, f(x)))
