Use alternative implementation of `groupby` and `merge_with`.

These appear to be generally faster by using `PyDict_GetItem` and checking
for NULL instead of using `PyDict_Contains`.