#NEWLINE# def serialize( self ) : #NEWLINE# #INDENT# if ( self . type_ < OSPF_OPAQUE_LINK_LSA ) : #NEWLINE# #INDENT# id_ = addrconv . ipv4 . text_to_bin ( self . id_ ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# id_ = ( ( self . opaque_type << 24 ) + self . opaque_id ) #NEWLINE# ( id_ , ) = struct . unpack_from ( '4s' , struct . pack ( '!I' , self ) ) #NEWLINE# #UNINDENT# adv_router = addrconv . ipv4 . text_to_bin ( self . adv_router ) #NEWLINE# return bytearray ( struct . pack ( self . _HDR_PACK_STR , self . ls_age , self . options , self . type_ , id_ , adv_router , self . ls_seqnum , self . checksum , self . length ) )