Parse the <bank> element of the connection capabilities XML.

def _parse_caps_bank(bank):
    '''
    Parse the <bank> element of the connection capabilities XML.
    '''
    result = {
        'id': int(bank.get('id')),
        'level': int(bank.get('level')),
        'type': bank.get('type'),
        'size': "{} {}".format(bank.get('size'), bank.get('unit')),
        'cpus': bank.get('cpus')
    }

    controls = []
    for control in bank.findall('control'):
        unit = control.get('unit')
        result_control = {
            'granularity': "{} {}".format(control.get('granularity'), unit),
            'type': control.get('type'),
            'maxAllocs': int(control.get('maxAllocs'))
        }

        minimum = control.get('min')
        if minimum:
            result_control['min'] = "{} {}".format(minimum, unit)
        controls.append(result_control)
    if controls:
        result['controls'] = controls

    return result