Parse the <cell> nodes of the connection capabilities XML output.

def _parse_caps_cell(cell):
    '''
    Parse the <cell> nodes of the connection capabilities XML output.
    '''
    result = {
        'id': int(cell.get('id'))
    }

    mem_node = cell.find('memory')
    if mem_node is not None:
        unit = mem_node.get('unit', 'KiB')
        memory = mem_node.text
        result['memory'] = "{} {}".format(memory, unit)

    pages = [{'size': "{} {}".format(page.get('size'), page.get('unit', 'KiB')),
              'available': int(page.text)}
             for page in cell.findall('pages')]
    if pages:
        result['pages'] = pages

    distances = {int(distance.get('id')): int(distance.get('value'))
                 for distance in cell.findall('distances/sibling')}
    if distances:
        result['distances'] = distances

    cpus = []
    for cpu_node in cell.findall('cpus/cpu'):
        cpu = {
            'id': int(cpu_node.get('id'))
        }
        socket_id = cpu_node.get('socket_id')
        if socket_id:
            cpu['socket_id'] = int(socket_id)

        core_id = cpu_node.get('core_id')
        if core_id:
            cpu['core_id'] = int(core_id)
        siblings = cpu_node.get('siblings')
        if siblings:
            cpu['siblings'] = siblings
        cpus.append(cpu)
    if cpus:
        result['cpus'] = cpus

    return result