Loop Functions In Python Lambda If Function With Multiple Criteria