Python Relative Entropy Formula