code: def _sample_at_rate(
      example: pa.RecordBatch, sample_rate: float
  ) -> Generator[pa.RecordBatch, None, None]:
      """Sample examples at input sampling rate."""
      if random.random() <= sample_rate:
          yield example
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import random
  from typing import Generator, Text, Optional
  import apache_beam
  import pyarrow
  from tensorflow_data_validation.utils import artifacts_io_impl
  from tensorflow_data_validation.statistics import stats_impl
  from tensorflow_data_validation.statistics import stats_options
  from tfx_bsl.statistics import merge_util
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: _sample_at_rate(example, sample_rate) without return types