This function can add a param to write its output into a file, you can see dumpxml() in virsh.py