Port model string to support Python 2/3