'Seek in data.
On uncompressed files, the seeking works by actual
seeks so it\'s fast.  On compresses files its slow
- forward seeking happends by reading ahead,
backwards by re-opening and decompressing from the start.'

def seek(self, ofs, whence=0):

    self._md_context = NoHashContext()
    fsize = self._inf.file_size
    cur_ofs = self.tell()
    if (whence == 0):
        new_ofs = ofs
    elif (whence == 1):
        new_ofs = (cur_ofs + ofs)
    elif (whence == 2):
        new_ofs = (fsize + ofs)
    else:
        raise ValueError('Invalid    value    for    whence')
    if (new_ofs < 0):
        new_ofs = 0
    elif (new_ofs > fsize):
        new_ofs = fsize
    if (new_ofs >= cur_ofs):
        self._skip((new_ofs - cur_ofs))
    else:
        self._open()
        self._skip(new_ofs)
    return self.tell()
