code: def test_rdd_stratified_sampler_func(self):
      # SPARK-38879: Test case to improve test coverage for RDDSampler
      # RDDStratifiedSampler.func
  
      fractions = {"a": 0.8, "b": 0.2}
      rdd = self.sc.parallelize(fractions.keys()).cartesian(
          self.sc.parallelize(range(0, 100))
      )
      sample_data = dict(
          rdd.mapPartitionsWithIndex(
              RDDStratifiedSampler(False, fractions, 10).func, True
          ).countByKey()
      )
      # Since a have higher sampling rate (0.8),
      # it will occur more number of times than b.
      self.assertGreater(sample_data["a"], sample_data["b"])
      self.assertGreater(sample_data["a"], 60)
      self.assertLess(sample_data["a"], 90)
      self.assertGreater(sample_data["b"], 15)
      self.assertLess(sample_data["b"], 30)
  
imports: from pyspark.testing.utils import ReusedPySparkTestCase
  from pyspark.rddsampler import RDDSampler, RDDStratifiedSampler
label_desc: Use image node_id 2 for calling the RDDSamplerTests obj's underlying member method code with example usage: obj.test_rdd_stratified_sampler_func() without return types