'Fetches a next line backword.
This is used to locate the trailers at the end of a file.'

def revreadlines(self):

    self.fp.seek(0, 2)
    pos = self.fp.tell()
    buf = ''
    while (0 < pos):
        prevpos = pos
        pos = max(0, (pos - self.BUFSIZ))
        self.fp.seek(pos)
        s = self.fp.read((prevpos - pos))
        if (not s):
            break
        while 1:
            n = max(s.rfind('\r'), s.rfind('\n'))
            if (n == (-1)):
                buf = (s + buf)
                break
            (yield (s[n:] + buf))
            s = s[:n]
            buf = ''
    return
