This is a very common pattern in Python. But I'll push a "safer" code just for clarity.