[python mode] Fix bug in handling of lambda