python check optional is not none