'Returns True if this network is in the specified network.
network is a dotted quad (with or without a CIDR or normal style
netmask, which can also be specified separately via the netmask
parameter), or it can be a tuple of (address,network-bits) like that
returned by parse_cidr().'

def inNetwork(self, network, netmask=None):

    if (type(network) is not tuple):
        if (netmask is not None):
            network = str(network)
            network += ('/' + str(netmask))
        (n, b) = parse_cidr(network)
    else:
        (n, b) = network
        if (type(n) is not IPAddr):
            n = IPAddr(n)
    return ((self.toUnsigned() & (~ ((1 << (32 - b)) - 1))) == n.toUnsigned())
