def file_reader(fp, chunk_size=CHUNK_SIZE):
 while 1:
  data = fp.read(chunk_size)
  if (not data):
   break
  (yield data)
 fp.close()

def file_reader ( fp , chunk_size = CHUNK_SIZE ) : while 1 : data = fp . read ( chunk_size ) if ( not data ) : break ( yield data ) fp . close ( )
this generator yields the open fileobject in chunks .