'Asynchronous equivalent of `map()` builtin'

def map_async(self, func, iterable, chunksize=None, callback=None):

    if (not hasattr(iterable, '__len__')):
        iterable = list(iterable)
    if (chunksize is None):
        (chunksize, extra) = divmod(len(iterable), (len(self._pool) * 4))
        if extra:
            chunksize += 1
    if (len(iterable) == 0):
        chunksize = 0
    task_batches = Pool._get_tasks(func, iterable, chunksize)
    result = MapResult(self._cache, chunksize, len(iterable), callback)
    self._taskqueue.put((((result._job, i, mapstar, (x,), {}) for (i, x) in enumerate(task_batches)), None))
    return result
