code: def seek(self, offset, whence=0):
          
          if self.closed:
              raise ValueError("I/O operation on closed file")
          if whence == 0:
              if offset < 0:
                  raise IOError('seek would move position outside the file')
              self.pos = offset
          elif whence == 1:
              if self.pos + offset < 0:
                  raise IOError('seek would move position outside the file')
              self.pos += offset
          elif whence == 2:
              if self.size + offset < 0:
                  raise IOError('seek would move position outside the file')
              self.pos = self.size + offset
          return self.pos
docs: Move to a new offset either relative or absolute. whence=0 is
          absolute, whence=1 is relative, whence=2 is relative to the end.
  
          Any relative or absolute seek operation which would result in a
          negative position is undefined and that case can be ignored
          in the implementation.
  
          Any seek operation which moves the position after the stream
          should succeed. tell() should report that position and read()
          should return an empty bytes object.