code: def _ensure_file_is_good(self, current_time):
          
          if self._last_file_mapping_update and current_time - self._last_file_mapping_update <= self._stat_interval:
              return
  
          self._last_file_mapping_update = time.time()
  
          try:
              st = os.stat(self._filename)
          except EnvironmentError, err:
              if err.errno == errno.ENOENT:
                  self._log_info('file removed')
                  self.close()
                  return
              raise
  
          fid = self.get_file_id(st)
          if fid != self._fid:
              self._log_info('file rotated')
              self.close()
          elif self._file.tell() > st.st_size:
              if st.st_size == 0 and self._ignore_truncate:
                  self._logger.info("[{0}] - file size is 0 {1}. ".format(fid, self._filename) +
                                    "If you use another tool (i.e. logrotate) to truncate " +
                                    "the file, your application may continue to write to " +
                                    "the offset it last wrote later. In such a case, we'd " +
                                    "better do nothing here")
                  return
              self._log_info('file truncated')
              self._update_file(seek_to_end=False)
          elif REOPEN_FILES:
              self._log_debug('file reloaded (non-linux)')
              position = self._file.tell()
              self._update_file(seek_to_end=False)
              if self.active:
                  self._file.seek(position, os.SEEK_SET)
docs: Every N seconds, ensures that the file we are tailing is the file we expect to be tailing