nit: seems 'str' temporary is not needed.