Optimizing Cython code by writing less Python and more C