Use fused types to avoid tempita
A lot of the cython code is templated to avoid duplication, but is not especially readable (see anything in _libs with filename ending in ".pxi.in").

AFAICT we can use [fused types](https://cython.readthedocs.io/en/latest/src/userguide/fusedtypes.html#type-checking-specializations) and cython will internally generate all of the relevant functions.  If this understanding is correct, the code can be made a lot friendlier.