Entropy Generating Function Method In Python