def normalize(self):
total = float(sum(self.prob.values()))<EOL>if not (<NUM_LIT:1.0>-epsilon < total < <NUM_LIT:1.0>+epsilon):<EOL><INDENT>for val in self.prob:<EOL><INDENT>self.prob[val] /= total<EOL><DEDENT><DEDENT>return self<EOL>
Make sure the probabilities of all values sum to 1.
        Returns the normalized distribution.
        Raises a ZeroDivisionError if the sum of the values is 0.
        >>> P = ProbDist('Flip'); P['H'], P['T'] = 35, 65
        >>> P = P.normalize()
        >>> print '%5.3f %5.3f' % (P.prob['H'], P.prob['T'])
        0.350 0.650