code: def sample_custom_pmf(self, pmf):
      total = sum(pmf)
      scale = 1 / total
      pmf = [x * scale for x in pmf]
      draw = random.random()
      sum_prob = 0.0
      for index, prob in enumerate(pmf):
          sum_prob += prob
          if sum_prob > draw:
              return index, prob
  
imports: import vowpalwabbit
  from distributionally_robust_data import OnlineCressieRead
  import collections
  import os
  import random
  import os
label_desc: Use image node_id 4 for calling the Simulator obj's underlying member method code with example usage: obj.sample_custom_pmf(pmf) and returns: index,  prob