Bugfix for bug 1084070
Adding logging and reorganizing imports
Adding a blank line for PEP8 compliance
Move imports into migrate().

It's not very PEP8 compliant, but it results in fewer lines with increased
clarity.
Merge pull request #885 from pulp/bmbouter-1084070

Bugfix for 1084070