'Returns True if this address is in the specified network.
network can be specified as:
IPAddr6 with numeric netbits or netmask in netmask parameter
textual network with numeric netbits or netmask in netmask parameter
textual network with netbits or netmask separated by a slash
tuple of textual address and numeric netbits
tuple of IPAddr6 and numeric netbits'

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

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