#NEWLINE# def encode( self ) : #NEWLINE# #INDENT# pieces = list ( ) #NEWLINE# data . encode_table ( self , self . client_properties ) #NEWLINE# assert isinstance ( self . mechanism , str_or_bytes ) , 'A non-string value was supplied for self.mechanism' #NEWLINE# data . encode_short_string ( pieces , self . mechanism ) #NEWLINE# assert isinstance ( self . response , str_or_bytes ) , 'A non-string value was supplied for self.response' #NEWLINE# value = ( self . response . encode ( 'utf-8' ) if isinstance ( self . response , unicode_type ) else self . response ) #NEWLINE# pieces . append ( struct . pack ( '>I' , len ( value ) ) ) #NEWLINE# pieces . append ( value ) #NEWLINE# assert isinstance ( self . locale , str_or_bytes ) , 'A non-string value was supplied for self.locale' #NEWLINE# data . encode_short_string ( pieces , self . locale ) #NEWLINE# return pieces