Lambda Function If Else In Python Code