testme = lambda x: lambda y: x
_testme = dill.loads(dill.dumps(testme))
testme
_testme

def complicated(a, b):

    def nested(x):
        return testme(x)(a) * b
return nested
_complicated = dill.loads(dill.dumps(complicated))
complicated
_complicated
сериализация и десериализация лямбд