'this function parses qhost -xml output and makes a neat array
takes in a string, so we can pipe in output from ssh.exec(\'qhost -xml\')'

def parse_qhost(self, qhost_out):

    self.hosts = []
    doc = xml.dom.minidom.parseString(qhost_out)
    for h in doc.getElementsByTagName('host'):
        name = h.getAttribute('name')
        hash = {'name': name}
        for stat in h.getElementsByTagName('hostvalue'):
            for hvalue in stat.childNodes:
                attr = stat.attributes['name'].value
                val = ''
                if (hvalue.nodeType == xml.dom.minidom.Node.TEXT_NODE):
                    val = hvalue.data
                hash[attr] = val
        if (hash['name'] != u'global'):
            self.hosts.append(hash)
    return self.hosts
