Rosemary's written an implementation in C, so it should just be matter of writing the hooks from this code into Python as a shared library.