'Whether or not address is a valid ipv4 address or ipv6 address'

def _is_valid_ip(self, address):

    try:
        ipaddr.IPNetwork(address)
    except ValueError:
        return False
    return True
