pure python implementation of our likelihood