I think the code would be a little more readable if you didn't handle `squared` on the Cython side.