code: def open_gwf(filename, mode='r'):
      
      if mode not in ('r', 'w'):
          raise ValueError("mode must be either 'r' or 'w'")
      from LDAStools import frameCPP
      filename = urlparse(filename).path  # strip file://localhost or similar
      if mode == 'r':
          return frameCPP.IFrameFStream(str(filename))
      return frameCPP.OFrameFStream(str(filename))
docs: Open a filename for reading or writing GWF format data
  
      Parameters
      ----------
      filename : `str`
          the path to read from, or write to
  
      mode : `str`, optional
          either ``'r'`` (read) or ``'w'`` (write)
  
      Returns
      -------
      `LDAStools.frameCPP.IFrameFStream`
          the input frame stream (if `mode='r'`), or
      `LDAStools.frameCPP.IFrameFStream`
          the output frame stream (if `mode='w'`)