def asip(ip):
 if isinstance(ip, IPAddr):
  return ip
 return IPAddr(ip)

def asip ( ip ) : if isinstance ( ip , IPAddr ) : return ip return IPAddr ( ip )
a little helper to guarantee ip being an ipaddr instance .