code: def _find_curr_line(self, prev=False):
          
          curr_pos = self.filehandle.tell()
  
          # jump back 15k characters (at most) and find last newline char
          jump_back = min(self.filehandle.tell(), 15000)
          self.filehandle.seek(-jump_back, 1)
          buff = self.filehandle.read(jump_back)
          self.filehandle.seek(curr_pos, 0)
  
          if prev and self.prev_pos is not None and self.prev_pos == curr_pos:
              # Number of characters to show before/after the log offset
              error_context = 300
              self.filehandle.seek(-error_context, 1)
              buff = self.filehandle.read(curr_pos)
              hr = "-" * 60
              print("Fatal log parsing loop detected trying to find previous "
                    "log line near offset %s in %s:\n\n%s\n%s\n"
                    "<--- (current log parsing offset) \n%s\n%s\n"
                    % (curr_pos, self.name, hr, buff[:error_context],
                       buff[error_context:error_context + 1], hr),
                    file=sys.stderr)
              raise SystemExit("Cannot parse %s with requested options"
                               % self.filehandle.name)
          else:
              self.prev_pos = curr_pos
          buff = buff.decode("utf-8", "replace")
          newline_pos = buff.rfind('\n')
          if prev:
              newline_pos = buff[:newline_pos].rfind('\n')
  
          # move back to last newline char
          if newline_pos == -1:
              self.filehandle.seek(0)
              return self.next()
  
          self.filehandle.seek(newline_pos - jump_back + 1, 1)
  
          # roll forward until we found a line with a datetime
          try:
              logevent = self.next()
              while not logevent.datetime:
                  logevent = self.next()
  
              return logevent
          except StopIteration:
              # reached end of file
              return None
docs: Internal helper function.
  
          Find the current (or previous if prev=True) line in a log file based on
          the current seek position.