code: def fetch(self, buf = None, traceno = None):
          
  
          if buf is None:
              buf = self.buf
  
          if traceno is None:
              traceno = self.traceno
  
          try:
              if self.kind == TraceField:
                  if traceno is None: return buf
                  return self.filehandle.getth(traceno, buf)
              else:
                  return self.filehandle.getbin()
          except IOError:
              if not self.readonly:
                  # the file was probably newly created and the trace header
                  # hasn't been written yet, and we set the buffer to zero. if
                  # this is the case we want to try and write it later, and if
                  # the file was broken, permissions were wrong etc writing will
                  # fail too
                  #
                  # if the file is opened read-only and this happens, there's no
                  # way to actually write and the error is an actual error
                  return bytearray(len(self.buf))
              else: raise
docs: Fetch the header from disk
  
          This object will read header when it is constructed, which means it
          might be out-of-date if the file is updated through some other handle.
          This method is largely meant for internal use - if you need to reload
          disk contents, use ``reload``.
  
          Fetch does not update any internal state (unless `buf` is ``None`` on a
          trace header, and the read succeeds), but returns the fetched header
          contents.
  
          This method can be used to reposition the trace header, which is useful
          for constructing generators.
  
          If this is called on a writable, new file, and this header has not yet
          been written to, it will successfully return an empty buffer that, when
          written to, will be reflected on disk.
  
          Parameters
          ----------
          buf     : bytearray
              buffer to read into instead of ``self.buf``
          traceno : int
  
          Returns
          -------
          buf : bytearray
  
          Notes
          -----
          .. versionadded:: 1.6
  
          This method is not intended as user-oriented functionality, but might
          be useful in high-performance code.