def ip_to_int(ip):
 ret = 0
 for octet in ip.split('.'):
  ret = ((ret * 256) + int(octet))
 return ret

def ip_to_int ( ip ) : ret = 0 for octet in ip . split ( '.' ) : ret = ( ( ret * 256 ) + int ( octet ) ) return ret
converts an ip address to an integer .