code: def check_weights(nodes_with_a_weight):
      
      weights = [n['weight'] for n in nodes_with_a_weight]
      if abs(sum(weights) - 1.) > PRECISION:
          raise ValueError('The weights do not sum up to 1: %s' % weights)
      return nodes_with_a_weight
docs: Ensure that the sum of the values is 1
  
      :param nodes_with_a_weight: a list of Node objects with a weight attribute