def _filehandle(self):
if not self._fh or self._is_closed():<EOL><INDENT>filename = self._rotated_logfile or self.filename<EOL>if filename.endswith('<STR_LIT>'):<EOL><INDENT>self._fh = gzip.open(filename, '<STR_LIT:r>')<EOL><DEDENT>else:<EOL><INDENT>self._fh = open(filename, "<STR_LIT:r>", <NUM_LIT:1>)<EOL><DEDENT>if self.read_from_end and not exists(self._offset_file):<EOL><INDENT>self._fh.seek(<NUM_LIT:0>, os.SEEK_END)<EOL><DEDENT>else:<EOL><INDENT>self._fh.seek(self._offset)<EOL><DEDENT><DEDENT>return self._fh<EOL>
Return a filehandle to the file being tailed, with the position set
to the current offset.