Update migration.py

Fixed python3.x compatibility.