def calc_networks(network, nq=None):
    network.update_network()
    eldars = []
    sub_networks = []
    if not nq:
        nq = Network.objects.all()

    for pnet in nq.order_by('prefixlen', 'ip_upper', 'ip_lower'):
        pnet.update_network()
        if pnet.pk == network.pk:
            continue
        if pnet.network.overlaps(network.network):
            if pnet.prefixlen > network.prefixlen:
                sub_networks.append(pnet)
            else:
                eldars.append(pnet)

    return eldars, sub_networks
dataset/ETHPy150Open mozilla/inventory/core/network/utils.py/calc_networks/original