def _ip_int_from_string(self, ip_str):
        """Turn the given IP string into an integer for comparison.

        Args:
            ip_str: A string, the IP ip_str.

        Returns:
            The IP ip_str as an integer.

        Raises:
            AddressValueError: if the string isn't a valid IP string.

        """
        packed_ip = 0
        octets = ip_str.split('.')
        if len(octets) != 4:
            raise AddressValueError(ip_str)
        for oc in octets:
            try:
                packed_ip = (packed_ip << 8) | int(oc)
            except __HOLE__:
                raise AddressValueError(ip_str)
        return packed_ip
dataset/ETHPy150Open anandology/pyjamas/pyjs/src/pyjs/lib/ipaddr.py/_BaseV4._ip_int_from_string