#NEWLINE# def read_with_timeout( self , size ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# with StorletTimeout ( self . timeout ) : #NEWLINE# #INDENT# chunk = os . read ( self . obj_data , size ) #NEWLINE# #UNINDENT# #UNINDENT# except StorletTimeout : #NEWLINE# #INDENT# if self . cancel_func : #NEWLINE# #INDENT# self . cancel_func ( ) #NEWLINE# #UNINDENT# self . close ( ) #NEWLINE# raise #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# self . close ( ) #NEWLINE# raise #NEWLINE# #UNINDENT# return chunk