a python convertion from the ruby implementation of Rémi Coulom's Whole-History Rating (WHR) algorithm.