int(__import__("ipaddress").IPv4Address("127.0.0.1"))
# or  python < 3.3
def ip2int(ip):
     s=24; ret = 0
     for i in ip.split("."):
         ret += (int(i)<<s); s-=8
     return ret

