A porting of rps.js to Python