add a python impl, which actually works