use lambda, add python implementation