python check if any element in list matches condition