def calculate_network_stats(bam_network, config_id, config_name):
    if (bam_network.get_type() == 'IP4Network'):
        network_address = bam_network.get_property('CIDR')
        network = ipaddress.ip_network(network_address)
    else:
        network_address = bam_network.get_property('prefix')
        network = ipaddress.ip_network(network_address)
    ip_addresses = []
    ip_data = {}
    if (bam_network.get_type() == 'IP4Network'):
        for n in bam_network.get_children_of_type('IP4Address'):
            ip_data = {}
            ip_data.update({'ip_address': n.get_address()})
            ip_data.update({'properties': n.get_properties()})
            ip_data.update({'config_id': config_id})
            ip_data.update({'config_name': config_name})
            ip_data.update({'id': n.get_id()})
            ip_addresses.append(ip_data)
        next_address = bam_network.get_next_available_ip4_address()
    else:
        for n in bam_network.get_children_of_type('IP6Address'):
            ip_data = {}
            ip_data.update({'ip_address': n.get_address()})
            ip_data.update({'properties': n.get_properties()})
            ip_data.update({'config_id': config_id})
            ip_data.update({'config_name': config_name})
            ip_data.update({'id': n.get_id()})
            ip_addresses.append(ip_data)
    return ip_addresses
def calculate_network_stats(bam_network, config_id, config_name):
    if (bam_network.get_type() == 'IP4Network'):
        network_address = bam_network.get_property('CIDR')
        network = ipaddress.ip_network(network_address)
    else:
        network_address = bam_network.get_property('prefix')
        network = ipaddress.ip_network(network_address)
    ip_addresses = []
    ip_data = {}
    if (bam_network.get_type() == 'IP4Network'):
        for n in bam_network.get_children_of_type('IP4Address'):
            ip_data = {}
            ip_data.update({'ip_address': n.get_address()})
            ip_data.update({'properties': n.get_properties()})
            ip_data.update({'config_id': config_id})
            ip_data.update({'config_name': config_name})
            ip_data.update({'id': n.get_id()})
            ip_addresses.append(ip_data)
        next_address = bam_network.get_next_available_ip4_address()
    else:
        for n in bam_network.get_children_of_type('IP6Address'):
            ip_data = {}
            ip_data.update({'ip_address': n.get_address()})
            ip_data.update({'properties': n.get_properties()})
            ip_data.update({'config_id': config_id})
            ip_data.update({'config_name': config_name})
            ip_data.update({'id': n.get_id()})
            ip_addresses.append(ip_data)
    return ip_addresses