This is essentially taken from pmg-rs and should be used from there. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>