code: def _pmap(self, func, items, keys, pool, bookkeeping_dict=None):
          
          if keys is not None:  # Otherwise, cannot hash items
              # Remove duplicates first (use keys)
              # Create mapping (dict) of key to list of indices
              key_indices = _duplicates(keys).values()
          else:  # Cannot hash items
              # Assume no duplicates
              key_indices = [[i] for i in range(len(items))]
  
          # Use only the first of duplicate indices in decoding
          if pool is not None:
              # Parallel map
              results = pool.map(
                  functools.partial(_unpickle_run, pickle.dumps(func)),
                  [items[i[0]] for i in key_indices])
          else:
              results = map(func, [items[i[0]] for i in key_indices])
  
          # Add bookkeeping
          if bookkeeping_dict is not None:
              bookkeeping_dict['key_indices'] = key_indices
  
          # Combine duplicates back into list
          all_results = [None] * len(items)
          for indices, result in zip(key_indices, results):
              for j, i in enumerate(indices):
                  # Avoid duplicate result objects in list,
                  # in case they are used in functions with side effects
                  if j > 0:
                      result = copy.deepcopy(result)
                  all_results[i] = result
  
          return all_results
docs: Efficiently map func over all items.
  
          Calls func only once for duplicate items.
              Item duplicates are detected by corresponding keys.
              Unless keys is None.
  
          Serial if pool is None, but still skips duplicates.