virttest.utils_test.libvirt: add new test utilities

Remote access libvirtd will use these 2 new functions, and other test cases also probably reuse them, so move these 2 functions from test cases to virttest/utils_test/libvirt.py.