class_docstr: Performs DP aggregations.
class_docstr_tok: ["Performs","DP","aggregations","."]
docstr: Selects and returns private partitions.
  
  Args:
      col: collection, with types for each element:
          (partition_key, Accumulator)
      max_partitions_contributed: maximum amount of partitions that one
      privacy unit might contribute.
      strategy: which strategy to use for partition selection.
  
  Returns:
      collection of elements (partition_key, accumulator).
docstr_tok: ["Selects","and","returns","private","partitions",".","Args",":","col",":","collection",",","with","types","for","each","element",":","(","partition_key",",","Accumulator",")","max_partitions_contributed",":","maximum","amount","of","partitions","that","one","privacy","unit","might","contribute",".","strategy",":","which","strategy","to","use","for","partition","selection",".","Returns",":","collection","of","elements","(","partition_key",",","accumulator",")","."]
code: def _select_private_partitions_internal(
      self,
      col,
      max_partitions_contributed: int,
      max_rows_per_privacy_id: int,
      strategy: pipeline_dp.PartitionSelectionStrategy,
      pre_threshold: Optional[int],
  ):
      """Selects and returns private partitions.
  
      Args:
          col: collection, with types for each element:
              (partition_key, Accumulator)
          max_partitions_contributed: maximum amount of partitions that one
          privacy unit might contribute.
          strategy: which strategy to use for partition selection.
  
      Returns:
          collection of elements (partition_key, accumulator).
      """
      budget = self._budget_accountant.request_budget(
          mechanism_type=pipeline_dp.MechanismType.GENERIC
      )
  
      def filter_fn(
          budget: "MechanismSpec",
          max_partitions: int,
          max_rows_per_privacy_id: int,
          strategy: pipeline_dp.PartitionSelectionStrategy,
          pre_threshold: Optional[int],
          row: Tuple[Any, combiners.CompoundCombiner.AccumulatorType],
      ) -> bool:
          """Lazily creates a partition selection strategy and uses it to
          determine which partitions to keep."""
          row_count, _ = row[1]
  
          def divide_and_round_up(a, b):
              return (a + b - 1) // b
  
          # A conservative (lower) estimate of how many privacy IDs
          # contributed to this partition. This estimate is only needed when
          # privacy IDs are not available in the original dataset.
          privacy_id_count = divide_and_round_up(
              row_count, max_rows_per_privacy_id
          )
  
          selector = (
              partition_selection.create_partition_selection_strategy(
                  strategy,
                  budget.eps,
                  budget.delta,
                  max_partitions,
                  pre_threshold,
              )
          )
          return selector.should_keep(privacy_id_count)
  
      # make filter_fn serializable
      filter_fn = functools.partial(
          filter_fn,
          budget,
          max_partitions_contributed,
          max_rows_per_privacy_id,
          strategy,
          pre_threshold,
      )
      pre_threshold_str = (
          f", pre_threshold={pre_threshold}" if pre_threshold else ""
      )
      self._add_report_stage(
          lambda: f"Private Partition selection: using {strategy.value} "
          f"method with (eps={budget.eps}, delta={budget.delta}"
          f"{pre_threshold_str})"
      )
  
      return self._backend.filter(
          col, filter_fn, "Filter private partitions"
      )
  
imports: import functools
  from typing import Any, Callable, Optional, Sequence, Tuple, Union
  import pipeline_dp
  from pipeline_dp import budget_accounting
  from pipeline_dp import combiners
  from pipeline_dp import contribution_bounders
  from pipeline_dp import dp_computations
  from pipeline_dp import partition_selection
  from pipeline_dp import pipeline_functions
  from pipeline_dp import report_generator
  from pipeline_dp import sampling_utils
  from pipeline_dp.dataset_histograms import computing_histograms
  from pipeline_dp.private_contribution_bounds import PrivateL0Calculator
label_desc: Use image node_id 14 for calling the DPEngine obj's underlying member method code with example usage: obj._select_private_partitions_internal(col, max_partitions_contributed, max_rows_per_privacy_id, strategy, pre_threshold) and returns: self, selector, unknown