def _subtract(supernet, subnets, subnet_idx, ranges):
    version = supernet._module.version
    subnet = subnets[subnet_idx]
    if subnet.first > supernet.first:
        ranges.append((version, supernet.first, subnet.first - 1))

    subnet_idx += 1
    prev_subnet = subnet
    while subnet_idx < len(subnets):
        cur_subnet = subnets[subnet_idx]

        if cur_subnet not in supernet:
            break
        if prev_subnet.last + 1 == cur_subnet.first:
            # two adjacent, non-mergable IPNetworks
            pass
        else:
            ranges.append((version, prev_subnet.last + 1, cur_subnet.first - 1))

        subnet_idx += 1
        prev_subnet = cur_subnet

    first = prev_subnet.last + 1
    last = supernet.last
    if first <= last:
        ranges.append((version, first, last))

    return subnet_idx
Populates the cmdset
dataset/ETHPy150Open drkjam/netaddr/netaddr/ip/sets.py/_subtract--crossover with--dataset/ETHPy150Open evennia/evennia/evennia/commands/default/cmdset_player.py/PlayerCmdSet.at_cmdset_creation