Cython implementation of `toolz`