'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.'

def _ip_int_from_string(self, ip_str):

    packed_ip = 0
    for oc in ip_str.split('.'):
        packed_ip = ((packed_ip << 8) | int(oc))
    return packed_ip
