def seek(self, offset, whence=SEEK_SET):
        """
        Change the stream position to the given byte offset.

        Args:
            offset (int): Offset is interpreted relative to the position
                indicated by whence.
            whence (int): The default value for whence is SEEK_SET.
                Values for whence are:
                SEEK_SET or 0 – start of the stream (the default);
                offset should be zero or positive
                SEEK_CUR or 1 – current stream position;
                offset may be negative
                SEEK_END or 2 – end of the stream;
                offset is usually negative

        Returns:
            int: The new absolute position.
        """
        if not self._seekable:
            raise UnsupportedOperation('seek')

        seek = self._update_seek(offset, whence)

        # If seek move out of file, add padding until new seek position.
        if self._writable:
            size = len(self._write_buffer)
            if seek > size:
                self._write_buffer[seek:size] = b'\0' * (seek - size)

        return seek
Change the stream position to the given byte offset.

        Args:
            offset (int): Offset is interpreted relative to the position
                indicated by whence.
            whence (int): The default value for whence is SEEK_SET.
                Values for whence are:
                SEEK_SET or 0 – start of the stream (the default);
                offset should be zero or positive
                SEEK_CUR or 1 – current stream position;
                offset may be negative
                SEEK_END or 2 – end of the stream;
                offset is usually negative

        Returns:
            int: The new absolute position.