#NEWLINE# def peek_file( file_obj , size = ( - 1 ) ) : #NEWLINE# #INDENT# if ( not callable ( getattr ( file_obj , 'seek' , None ) ) ) : #NEWLINE# #INDENT# raise TypeError ( ( 'expected seekable file object, not %r' % ( file_obj , ) ) ) #NEWLINE# #UNINDENT# cur_pos = file_obj . tell ( ) #NEWLINE# peek_data = file_obj . read ( size ) #NEWLINE# file_obj . seek ( cur_pos ) #NEWLINE# return peek_data