code: def _PartitionFn(
      record: Union[
          tf.train.Example,
          tf.train.SequenceExample,
          bytes,
          Dict[str, Any],
      ],
      num_partitions: int,
      buckets: List[int],
      split_config: example_gen_pb2.SplitConfig,
  ) -> int:
      """Partition function for the ExampleGen's output splits."""
      assert num_partitions == len(
          buckets
      ), "Partitions do not match bucket number."
      partition_str = _GeneratePartitionKey(record, split_config)
      bucket = (
          int(hashlib.sha256(partition_str).hexdigest(), 16)
          % buckets[-1]
      )
      # For example, if buckets is [10,50,80], there will be 3 splits:
      #   bucket >=0 && < 10, returns 0
      #   bucket >=10 && < 50, returns 1
      #   bucket >=50 && < 80, returns 2
      return bisect.bisect(buckets, bucket)
  
imports: import abc
  import bisect
  import hashlib
  import pickle
  from typing import Any, Dict, List, Union
  from absl import logging
  import apache_beam
  import tensorflow
  from tfx import types
  from tfx.components.example_gen import utils
  from tfx.components.example_gen import write_split
  from tfx.components.util import examples_utils
  from tfx.dsl.components.base import base_beam_executor
  from tfx.proto import example_gen_pb2
  from tfx.types import artifact_utils
  from tfx.types import standard_component_specs
  from tfx.utils import proto_utils
label_desc: Use image node_id 2 for calling a global function with example usage: _PartitionFn(record, num_partitions, buckets, split_config) and returns: bisect