'Turn an IPv6 ip_str into an integer.
Args:
ip_str: A string, the IPv6 ip_str.
Returns:
An int, the IPv6 address
Raises:
AddressValueError: if ip_str isn\'t a valid IPv6 Address.'

def _ip_int_from_string(self, ip_str):

    parts = ip_str.split(':')
    if (len(parts) < 3):
        raise AddressValueError(ip_str)
    if ('.' in parts[(-1)]):
        ipv4_int = IPv4Address(parts.pop())._ip
        parts.append(('%x' % ((ipv4_int >> 16) & 65535)))
        parts.append(('%x' % (ipv4_int & 65535)))
    if (len(parts) > (self._HEXTET_COUNT + 1)):
        raise AddressValueError(ip_str)
    try:
        (skip_index,) = ([i for i in range(1, (len(parts) - 1)) if (not parts[i])] or [None])
    except ValueError:
        raise AddressValueError(ip_str)
    if (skip_index is not None):
        parts_hi = skip_index
        parts_lo = ((len(parts) - skip_index) - 1)
        if (not parts[0]):
            parts_hi -= 1
            if parts_hi:
                raise AddressValueError(ip_str)
        if (not parts[(-1)]):
            parts_lo -= 1
            if parts_lo:
                raise AddressValueError(ip_str)
        parts_skipped = (self._HEXTET_COUNT - (parts_hi + parts_lo))
        if (parts_skipped < 1):
            raise AddressValueError(ip_str)
    else:
        if (len(parts) != self._HEXTET_COUNT):
            raise AddressValueError(ip_str)
        parts_hi = len(parts)
        parts_lo = 0
        parts_skipped = 0
    try:
        ip_int = 0
        for i in range(parts_hi):
            ip_int <<= 16
            ip_int |= self._parse_hextet(parts[i])
        ip_int <<= (16 * parts_skipped)
        for i in range((- parts_lo), 0):
            ip_int <<= 16
            ip_int |= self._parse_hextet(parts[i])
        return ip_int
    except ValueError:
        raise AddressValueError(ip_str)
