class_docstr: The GzipFile class simulates most of the methods of a file object with
  the exception of the truncate() method.
  
  This class only supports opening files in binary mode. If you need to open a
  compressed file in text mode, use the gzip.open() function.
class_docstr_tok: ["The","GzipFile","class","simulates","most","of","the","methods","of","a","file","object","with","the","exception","of","the","truncate","(",")","method",".","This","class","only","supports","opening","files","in","binary","mode",".","If","you","need","to","open","a","compressed","file","in","text","mode",",","use","the","gzip.open","(",")","function","."]
code: def seek(self, offset, whence=io.SEEK_SET):
      if self.mode == WRITE:
          self._check_not_closed()
          # Flush buffer to ensure validity of self.offset
          self._buffer.flush()
          if whence != io.SEEK_SET:
              if whence == io.SEEK_CUR:
                  offset = self.offset + offset
              else:
                  raise ValueError("Seek from end not supported")
          if offset < self.offset:
              raise OSError("Negative seek in write mode")
          count = offset - self.offset
          chunk = b"\0" * self._buffer_size
          for i in range(count // self._buffer_size):
              self.write(chunk)
          self.write(b"\0" * (count % self._buffer_size))
      elif self.mode == READ:
          self._check_not_closed()
          return self._buffer.seek(offset, whence)
  
      return self.offset
  
imports: import struct, sys, time, os
  import zlib
  import builtins
  import io
  import _compression
label_desc: Use image node_id 20 for calling the GzipFile obj's underlying member method code with example usage: obj.seek(offset, whence) and returns: self, self