def read_in_chunks(file_obj, chunk_size):
offset = <NUM_LIT:0><EOL>while True:<EOL><INDENT>data = file_obj.read(chunk_size)<EOL>if not data:<EOL><INDENT>break<EOL><DEDENT>yield data, offset<EOL>offset += len(data)<EOL><DEDENT>
Generator to read a file piece by piece.