better python 3 code for migratore