bayespputils.py: Removing some redundant code.
I noticed some duplicate code in bayespputils.py while editing it for another project. @david-keitel (one of the reviewers for the other project) suggested making a separate merge request for the duplicate code removal, so I have done so.