Could you use a private method and not a lambda? Lambdas cannot be pickled.