Implemented in Cython