code: def seek(self, offset, whence=0):
          
          self._check_can_seek()
  
          # Recalculate offset as an absolute file position.
          if whence == 0:
              pass
          elif whence == 1:
              offset = self._pos + offset
          elif whence == 2:
              # Seeking relative to EOF - we need to know the file's size.
              if self._size < 0:
                  self._read_all(return_data=False)
              offset = self._size + offset
          else:
              raise ValueError("Invalid value for whence: {}".format(whence))
  
          # Make it so that offset is the number of bytes to skip forward.
          if offset is None:
              #This is not needed on Python 3 where the comparison to self._pos
              #will fail with a TypeError.
              raise TypeError("Seek offset should be an integer, not None")
          if offset < self._pos:
              self._rewind()
          else:
              offset -= self._pos
  
          # Read and discard data until we reach the desired position.
          if self._mode != _MODE_READ_EOF:
              self._read_block(offset, return_data=False)
  
          return self._pos
docs: Change the file position.
  
          The new position is specified by offset, relative to the
          position indicated by whence. Possible 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, sp depending on the parameters,
          this operation may be extremely slow.