def _map_or_starmap_async(function, iterable, args, kwargs, map_or_starmap):
    """
    Shared function between parmap.map_async and parmap.starmap_async.
    Refer to those functions for details.
    """
    arg_newarg = (("parallel", "pm_parallel"), ("chunksize", "pm_chunksize"),
                  ("pool", "pm_pool"), ("processes", "pm_processes"),
                  ("callback", "pm_callback"),
                  ("error_callback", "pm_error_callback"))
    kwargs = _deprecated_kwargs(kwargs, arg_newarg)
    chunksize = kwargs.pop("pm_chunksize", None)
    callback = kwargs.pop("pm_callback", None)
    error_callback = kwargs.pop("pm_error_callback", None)
    parallel, pool, close_pool = _create_pool(kwargs)
    # Map:
    if parallel:
        func_star = _get_helper_func(map_or_starmap)
        try:
            if sys.version_info[0] == 2:  # does not support error_callback
                result = pool.map_async(func_star,
                                        izip(repeat(function),
                                             iterable,
                                             repeat(list(args)),
                                             repeat(kwargs)),
                                        chunksize, callback)
            else:
                result = pool.map_async(func_star,
                                        izip(repeat(function),
                                             iterable,
                                             repeat(list(args)),
                                             repeat(kwargs)),
                                        chunksize, callback, error_callback)
        finally:
            if close_pool:
                pool.close()
                result = _ParallelAsyncResult(result, pool)
            else:
                result = _ParallelAsyncResult(result)
    else:
        values = _serial_map_or_starmap(function, iterable, args, kwargs,
                                        False, map_or_starmap)
        result = _DummyAsyncResult(values)
    return result
Shared function between parmap.map_async and parmap.starmap_async.
    Refer to those functions for details.