code: def collect_values_per_partition_key_per_privacy_id(
      col, backend: pipeline_backend.PipelineBackend
  ):
      """Collects values into a list for each privacy_id and partition_key.
  
      The output collection is a mapping from privacy_id (i.e. each privacy_id
      from 'col' occurs exactly once) to a list [(partition_key, [values]].
      For any privacy_id, each partition_key it contributes to appear exactly
      once.
  
      Args:
          col: collection with elements (privacy_id,
          Iterable[(partition_key, value)]). It's assumed that each privacy_id
          occurs only once.
          backend: pipeline backend for performing operations on collections.
  
      Returns:
          collection with elements (privacy_id, [partition_key, [values]]).
      """
  
      def collect_values_per_partition_key_per_privacy_id_fn(
          input: Iterable,
      ):
          d = collections.defaultdict(list)
          for key, value in input:
              d[key].append(value)
          return list(d.items())
  
      return backend.map_values(
          col,
          collect_values_per_partition_key_per_privacy_id_fn,
          "Collect values per privacy_id and partition_key",
      )
  
file_path: pipelinedp/pipeline_dp/contribution_bounders.py
imports: import abc
  import collections
  from typing import Callable, Iterable
  import pipeline_dp
  from pipeline_dp import pipeline_backend
  from pipeline_dp import sampling_utils
label_desc: Use image node_id 1 for calling a global function with example usage: collect_values_per_partition_key_per_privacy_id(col, backend) and returns: backend, list