docs: def load(package, prefix, offset=0, limit=1000):
      """ Load lines from the log file with pagination support. """
      logs = package.all(LogFile, unicode(prefix))
      logs = sorted(logs, key=lambda l: l.name, reverse=True)
      seen = 0
      record = None
      tmp = tempfile.NamedTemporaryFile(suffix='.log')
      for log in logs:
          shutil.copyfileobj(log.fh(), tmp)
          tmp.seek(0)
          for line in reversed(list(tmp)):
              seen += 1
              if seen < offset:
                  continue
              if seen > limit:
                  tmp.close()
                  return
              try:
                  d, mo, l, m = line.split(' %s ' % SEP, 4)
                  if record is not None:
                      yield record
                  record = {'time': d, 'module': mo, 'level': l, 'message': m}
              except ValueError:
                  if record is not None:
                      record['message'] += '\n' + line
          tmp.seek(0)
      tmp.close()
      if record is not None:
          yield record