#NEWLINE# def read( self , size = None ) : #NEWLINE# #INDENT# data = EMPTY #NEWLINE# while True : #NEWLINE# #INDENT# if ( size and ( len ( data ) >= size ) ) : #NEWLINE# #INDENT# return data #NEWLINE# #UNINDENT# if ( not self . buffer ) : #NEWLINE# #INDENT# self . _fetch ( ) #NEWLINE# if ( not self . buffer ) : #NEWLINE# #INDENT# return data #NEWLINE# #UNINDENT# #UNINDENT# if size : #NEWLINE# #INDENT# remaining = ( size - len ( data ) ) #NEWLINE# data += self . buffer [ : remaining ] #NEWLINE# self . buffer = self . buffer [ remaining : ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# data += self . buffer