PR 1194 remake

Remake of PR 1194, fixing some import bugs found by pylint. @waynesun09 now needs to make the rest of the patchset against tp-libvirt.