code: def sample(self, value):
      idx = 1
      while idx < self.size:
          child = 2 * idx
          if value <= self.values[child]:
              idx = child
          else:
              value -= self.values[child]
              idx = child + 1
  
      return idx - self.size
  
file_path: dynet/examples/reinforcement-learning/reduce_tree.py
imports: import operator
  import numpy
label_desc: Use image node_id 2 for calling the SumTree obj's underlying member method code with example usage: obj.sample(value) and returns: unknown