3 bW@s4dZddlZddlZddlmZddZddZdS) zIPv4 helper functions.N) binary_typecCsJt|dkrtjjt|ts&t|}d|d|d|d|dfjS)zConvert an IPv4 address in network form to text form. @param address: The IPv4 address @type address: string @returns: string z %u.%u.%u.%urr)lendns exception SyntaxError isinstance bytearrayencode)Zaddressr/usr/lib/python3.6/ipv4.py inet_ntoas   rc Cst|ts|j}|jd}t|dkr0tjjx<|D]4}|jsJtjjt|dkr6|ddkr6tjjq6Wydd|D}t j d |StjjYnXd S) zConvert an IPv4 address in text form to network form. @param text: The IPv4 address @type text: string @returns: string .rrr0cSsg|] }t|qSr)int).0partrrr 8szinet_aton..BBBBN)r) r rr splitrrr r isdigitstructpack)textpartsrbytesrrr inet_aton%s     r)__doc__rZ dns.exceptionrZ_compatrrrrrrrs