def __init__(self, address):
        """Instantiate a new IPv6 address object.

        Args:
            address: A string or integer representing the IP

              Additionally, an integer can be passed, so
              IPv6Address('2001:4860::') ==
                IPv6Address(42541956101370907050197289607612071936L).
              or, more generally
              IPv6Address(IPv6Address('2001:4860::')._ip) ==
                IPv6Address('2001:4860::')

        Raises:
            AddressValueError: If address isn't a valid IPv6 address.

        """
        _BaseV6.__init__(self, address)

        # Efficient copy constructor.
        if isinstance(address, IPv6Address):
            self._ip = address._ip
            return

        # Efficient constructor from integer.
        if isinstance(address, (int, long)):
            self._ip = address
            if address < 0 or address > self._ALL_ONES:
                raise AddressValueError(address)
            return

        # Constructing from a packed address
        if isinstance(address, Bytes):
            try:
                hi, lo = struct.unpack('!QQ', address)
            except struct.error:
                raise AddressValueError(address)  # Wrong length.
            self._ip = (hi << 64) | lo
            return

        # Assume input argument to be string or any object representation
        # which converts into a formatted IP string.
        addr_str = str(address)
        self._ip = self._ip_int_from_string(addr_str)
def __init__ ( self , address ) : _BaseV6 . __init__ ( self , address ) if isinstance ( address , IPv6Address ) : self . _ip = address . _ip return if isinstance ( address , ( int , long ) ) : self . _ip = address if address < 0 or address > self . _ALL_ONES : raise AddressValueError ( address ) return if isinstance ( address , Bytes ) : try : hi , lo = struct . unpack ( '!QQ' , address ) except struct . error : raise AddressValueError ( address ) self . _ip = ( hi << 64 ) | lo return addr_str = str ( address ) self . _ip = self . _ip_int_from_string ( addr_str )
Instantiate a new IPv6 address object.

        Args:
            address: A string or integer representing the IP

              Additionally, an integer can be passed, so
              IPv6Address('2001:4860::') ==
                IPv6Address(42541956101370907050197289607612071936L).
              or, more generally
              IPv6Address(IPv6Address('2001:4860::')._ip) ==
                IPv6Address('2001:4860::')

        Raises:
            AddressValueError: If address isn't a valid IPv6 address.