def _IP(ip):
 ip_class = netaddr.ip.IPAddress
 if (isinstance(ip, ip_class) or (ip == '')):
  return ip
 else:
  return ip_class(ip)

def _IP ( ip ) : ip_class = netaddr . ip . IPAddress if ( isinstance ( ip , ip_class ) or ( ip == '' ) ) : return ip else : return ip_class ( ip )
returns a netaddr .