def _fun_factory(fun_wrap):

    def fun(P, x, y):
        parse_args(P, x, y)
fun_wrap()
return y
return fun
Using function factories in pyx/pxd files to generate cython function wrappers for C-library