def open_gwf(filename, mode='<STR_LIT:r>'):
if mode not in ('<STR_LIT:r>', '<STR_LIT:w>'):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>from LDAStools import frameCPP<EOL>filename = urlparse(filename).path  <EOL>if mode == '<STR_LIT:r>':<EOL><INDENT>return frameCPP.IFrameFStream(str(filename))<EOL><DEDENT>return frameCPP.OFrameFStream(str(filename))<EOL>
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'`)