python check if optional is not none