Useful spacewalk code. From https://www.redhat.com/archives/spacewalk-list/2013-April/msg00083.html