def _resolve(file, mode=_d['mode'], encoding=_d['encoding'],
             errors=_d['errors'], newline=_d['newline'],
             compression=_d['compression'], compresslevel=_d['compresslevel']):
    arguments = locals().copy()

    if mode not in {'r', 'w'}:
        raise ValueError("Unsupported mode: %r, use 'r' or 'w'" % mode)

    newfile = None
    source = None
    for source_handler in get_io_sources():
        source = source_handler(file, arguments)
        if mode == 'r' and source.can_read():
            newfile = source.get_reader()
            break
        elif mode == 'w' and source.can_write():
            newfile = source.get_writer()
            break

    if newfile is None:
        raise IOSourceError(
            (file, mode) % "Could not open source: %r (mode: %r)")

    return newfile, source, is_binary_file(newfile)
dataset/ETHPy150Open biocore/scikit-bio/skbio/io/util.py/_resolve/swapped operands of `%`