Factored context out from mapper and reducer since they are very similar.  Not sure if calling PyType_Ready twice breaks anything.