code: def domain_delete(domain, logger, filesystem):
      
      if domain is not None:
          try:
              if domain.isActive():
                  domain.destroy()
          except libvirt.libvirtError:
              logger.exception("Unable to destroy the domain.")
          try:
              domain.undefine()
          except libvirt.libvirtError:
              logger.exception("Unable to undefine the domain.")
          try:
              if filesystem is not None and os.path.exists(filesystem):
                  shutil.rmtree(filesystem)
          except Exception:
              logger.exception("Unable to remove the shared folder.")
docs: libvirt domain undefinition.
  
      @raise: libvirt.libvirtError.