#NEWLINE# def session_decode( self , data ) : #NEWLINE# #INDENT# 'Thanks to Ken Restivo for suggesting the addition\n    of session_encode\n    ' #NEWLINE# session = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# while ( len ( data ) > 0 ) : #NEWLINE# #INDENT# ( offset , key ) = self . read_until ( data , 0 , '|' ) #NEWLINE# if ( offset > 0 ) : #NEWLINE# #INDENT# ( dtype , dataoffset , value ) = self . _unserialize ( data , ( offset + 1 ) ) #NEWLINE# data = data [ ( ( offset + 1 ) + dataoffset ) : ] #NEWLINE# session [ key ] = value #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return session #NEWLINE# #UNINDENT# #UNINDENT# return session