'Attach a reducer function to a given type in the dispatch table.'

def register(self, type, reduce_func):

    if hasattr(Pickler, 'dispatch'):
        def dispatcher(self, obj):
            reduced = reduce_func(obj)
            self.save_reduce(obj=obj, *reduced)
        self.dispatch[type] = dispatcher
    else:
        self.dispatch_table[type] = reduce_func
