Support Py2.5 to Py3.4 for thread identity (thanks @lndbrg)