#NEWLINE# def split( fp ) : #NEWLINE# #INDENT# 'Read lines with headers until the start of body' #NEWLINE# lines = deque ( ) #NEWLINE# for line in fp : #NEWLINE# #INDENT# if ( len ( line ) > MAX_LINE_LENGTH ) : #NEWLINE# #INDENT# raise DecodingError ( 'Line is too long: {0}' . format ( len ( line ) ) ) #NEWLINE# #UNINDENT# if is_empty ( line ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# if ( not RE_HEADER . match ( lines ) ) : #NEWLINE# #INDENT# fp . seek ( ( fp . tell ( ) - len ( line ) ) ) #NEWLINE# break #NEWLINE# #UNINDENT# lines . append ( line ) #NEWLINE# #UNINDENT# return lines