Lambda Function With If Else Condition In Python