def _munge_file(file, is_binary_file, arguments):
    mode = arguments.get('mode', _d['mode'])
    encoding = arguments.get('encoding', _d['encoding'])
    errors = arguments.get('errors', _d['errors'])
    newline = arguments.get('newline', _d['newline'])
    compression = arguments.get('compression', _d['compression'])
    is_output_binary = encoding == 'binary'
    newfile = file

    compression_handler = get_compression_handler(compression)

    if is_output_binary and newline is not _d['newline']:
        raise ValueError("Cannot use `newline` with binary encoding.")

    if compression is not None and not compression_handler:
        raise ValueError(compression % "Unsupported compression: %r")

    if is_binary_file:
        if compression:
            c = compression_handler(newfile, arguments)
            if mode == 'w':
                newfile = CompressedBufferedWriter(file, c.get_writer(),
                                                   streamable=c.streamable)
            else:
                newfile = CompressedBufferedReader(file, c.get_reader())

        if not is_output_binary:
            newfile = SaneTextIOWrapper(newfile, encoding=encoding,
                                        errors=errors, newline=newline)
    else:
        if compression is not None and compression != 'auto':
            raise ValueError("Cannot use compression with that source.")
        if is_output_binary:
            raise ValueError("Source is not a binary source")

    return newfile
dataset/ETHPy150Open biocore/scikit-bio/skbio/io/util.py/_munge_file/swapped operands of `%`