docs: def _map_or_starmap(function, iterable, args, kwargs, map_or_starmap):
      """
      Shared function between parmap.map and parmap.starmap.
      Refer to those functions for details.
      """
      arg_newarg = (("parallel", "pm_parallel"), ("chunksize", "pm_chunksize"),
                    ("pool", "pm_pool"), ("processes", "pm_processes"),
                    ("parmap_progress", "pm_pbar"))
      kwargs = _deprecated_kwargs(kwargs, arg_newarg)
      chunksize = kwargs.pop("pm_chunksize", None)
      progress = kwargs.pop("pm_pbar", False)
      progress = progress and HAVE_TQDM
      parallel, pool, close_pool = _create_pool(kwargs)
      # Map:
      if parallel:
          func_star = _get_helper_func(map_or_starmap)
          try:
              if progress and close_pool:
                  try:
                      num_tasks = len(iterable)
                      # get a chunksize (as multiprocessing does):
                      chunksize = _get_default_chunksize(chunksize,
                                                         pool, num_tasks)
                      # use map_async to get progress information
                      result = pool.map_async(func_star,
                                              izip(repeat(function),
                                                   iterable,
                                                   repeat(list(args)),
                                                   repeat(kwargs)),
                                              chunksize)
                  finally:
                      pool.close()
                  # Progress bar:
                  try:
                      _do_pbar(result, num_tasks, chunksize)
                  finally:
                      output = result.get()
              else:
                  result = pool.map_async(func_star,
                                          izip(repeat(function),
                                               iterable,
                                               repeat(list(args)),
                                               repeat(kwargs)),
                                          chunksize)
                  output = result.get()
          finally:
              if close_pool:
                  if not progress:
                      pool.close()
                  pool.join()
      else:
          output = _serial_map_or_starmap(function, iterable, args, kwargs,
                                          progress, map_or_starmap)
      return output