'Simple subnet-based address pool
Allocates count IP addresses out of network/network_size, starting
with the first\'th.  You may specify the end of the range with either
last (to specify the last\'th address to use) or count to specify the
number to use.  If both are None, use up to the end of all
legal addresses.
Example for all of 192.168.x.x/16:
SimpleAddressPool("192.168.0.0/16", 1, 65534)'

def __init__(self, network='192.168.0.0/24', first=1, last=None, count=None):

    (network, network_size) = parse_cidr(network)
    self.first = first
    self.network_size = network_size
    self.host_size = (32 - network_size)
    self.network = IPAddr(network)
    if ((last is None) and (count is None)):
        self.last = ((1 << self.host_size) - 2)
    elif (last is not None):
        self.last = last
    elif (count is not None):
        self.last = ((self.first + count) - 1)
    else:
        raise RuntimeError('Cannot    specify    both    last    and    count')
    self.removed = set()
    if (self.count <= 0):
        raise RuntimeError('Bad    first/last    range')
    if (first == 0):
        raise RuntimeError("Can't    allocate    0th    address")
    if ((self.host_size < 0) or (self.host_size > 32)):
        raise RuntimeError('Bad    network')
    if (IPAddr((self.last | self.network.toUnsigned())) not in self):
        raise RuntimeError('Bad    first/last    range')
