def pretty_hex(ip, length=8):
 hexval = ('%x' % ip.value)
 if (len(hexval) < length):
  hexval = (('0' * (length - len(hexval))) + hexval)
 return hexval.upper()

def pretty_hex ( ip , length = 8 ) : hexval = ( '%x' % ip . value ) if ( len ( hexval ) < length ) : hexval = ( ( '0' * ( length - len ( hexval ) ) ) + hexval ) return hexval . upper ( )
pads an ip object with leading zeroes so that the result is _length_ hex digits .