#NEWLINE# def serialize( self , payload , prev ) : #NEWLINE# #INDENT# hdr = bytearray ( struct . pack ( icmp . _PACK_STR , self . type , self . code , self . csum ) ) #NEWLINE# if ( self . data is not None ) : #NEWLINE# #INDENT# if ( self . type in icmp . _ICMP_TYPES ) : #NEWLINE# #INDENT# hdr += self . data . serialize ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# hdr += self . data #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . data = echo ( ) #NEWLINE# hdr += self . data . serialize ( ) #NEWLINE# #UNINDENT# if ( self . csum == 0 ) : #NEWLINE# #INDENT# self . csum = packet_utils . checksum ( hdr ) #NEWLINE# struct . pack_into ( '!H' , hdr , 2 , self . csum ) #NEWLINE# #UNINDENT# return hdr