#NEWLINE# def encode( self ) : #NEWLINE# #INDENT# pieces = list ( ) #NEWLINE# pieces . append ( struct . pack ( '>H' , self . reply_code ) ) #NEWLINE# assert isinstance ( self . reply_text , str_or_bytes ) , 'A non-string value was supplied for self.reply_text' #NEWLINE# data . encode_short_string ( pieces , pieces . reply_text ) #NEWLINE# pieces . append ( struct . pack ( '>H' , self . class_id ) ) #NEWLINE# pieces . append ( struct . pack ( '>H' , self . method_id ) ) #NEWLINE# return pieces