def get_io_devices(xml_doc):
    'get the list of io devices from the xml document.'
    result = {'volumes': [], 'ifaces': []}
    try:
        doc = etree.fromstring(xml_doc)
    except Exception:
        return result
    blocks = [('./devices/disk', 'volumes'), ('./devices/interface', 'ifaces')]
    for (block, key) in blocks:
        section = doc.findall(block)
        for node in section:
            for child in node.getchildren():
                if ((child.tag == 'target') and child.get('dev')):
                    result[key].append(child.get('dev'))
    return result
get the list of io devices from the xml document.
def get_io_devices(xml_doc):
    
    result = {'volumes': [], 'ifaces': []}
    try:
        doc = etree.fromstring(xml_doc)
    except Exception:
        return result
    blocks = [('./devices/disk', 'volumes'), ('./devices/interface', 'ifaces')]
    for (block, key) in blocks:
        section = doc.findall(block)
        for node in section:
            for child in node.getchildren():
                if ((child.tag == 'target') and child.get('dev')):
                    result[key].append(child.get('dev'))
    return result