def obfuscate_ip(ip):
    """Obfuscate given host in IP form.
    @ip: IPv4 address string
    @return: hexadecimal IP string ('0x1ab...')
    @raise: ValueError on invalid IP addresses
    """
    if is_valid_ipv4(ip):
        res = "0x%s" % "".join(hex(int(x))[2:] for x in ip.split("."))
    else:
        raise ValueError('Invalid IP value %r' % ip)
    assert is_obfuscated_ip(res),  '%r obfuscation error' % res
    return res
def obfuscate_ip ( ip ) : if is_valid_ipv4 ( ip ) : res = "0x%s" % "" . join ( hex ( int ( x ) ) [ 2 : ] for x in ip . split ( "." ) ) else : raise ValueError ( 'Invalid IP value %r' % ip ) assert is_obfuscated_ip ( res ) , '%r obfuscation error' % res return res
Obfuscate given host in IP form.
    @ip: IPv4 address string
    @return: hexadecimal IP string ('0x1ab...')
    @raise: ValueError on invalid IP addresses