python check if string exists and is not empty