'Change the file position.
The new position is specified by offset, relative to the
position indicated by whence. Values for whence are:
0: start of stream (default); offset must not be negative
1: current stream position
2: end of stream; offset must not be positive
Returns the new file position.
Note that seeking is emulated, so depending on the parameters,
this operation may be extremely slow.'

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

    with self._lock:
        self._check_can_seek()
        if (whence == 0):
            pass
        elif (whence == 1):
            offset = (self._pos + offset)
        elif (whence == 2):
            if (self._size < 0):
                self._read_all(return_data=False)
            offset = (self._size + offset)
        else:
            raise ValueError(('Invalid    value    for    whence:    %s' % (whence,)))
        if (offset < self._pos):
            self._rewind()
        else:
            offset -= self._pos
        self._read_block(offset, return_data=False)
        return self._pos
