def wrap_with_mergestate(self, timsort, func, _cache={}):
        key = timsort, func
        if key in _cache:
            return _cache[key]

        merge_init = timsort.merge_init

        @timsort.compile
        def wrapper(keys, values, *args):
            ms = merge_init(keys)
            res = func(ms, keys, values, *args)
            return res

        _cache[key] = wrapper
        return wrapper
Wrap *func* into another compiled function inserting a runtime-created
dataset/ETHPy150Open numba/numba/numba/tests/test_sort.py/JITTimsortMixin.wrap_with_mergestate