def get_file_obj(fname, mode='r', encoding=None):
    if _is_string_like(fname):
        return _open(fname, mode, encoding)
    try:
        # Make sure the object has the write methods
        if 'r' in mode:
            fname.read
        if 'w' in mode or 'a' in mode:
            fname.write
    except AttributeError:
        raise ValueError('fname must be a string or a file-like object')
    return EmptyContextManager(fname)
open(name[, mode]) -> file object
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/iolib/openfile.py/get_file_obj--crossover with--dataset/ETHPy150Open mockfs/mockfs/mockfs/storage.py/open