def _write_raw_buffer(fid, buf, cals, fmt, inv_comp):
    if buf.shape[0] != len(cals):
        raise ValueError('buffer and calibration sizes do not match')

    if fmt not in ['short', 'int', 'single', 'double']:
        raise ValueError('fmt must be "short", "single", or "double"')

    if np.isrealobj(buf):
        if fmt == 'short':
            write_function = write_dau_pack16
        elif fmt == 'int':
            write_function = write_int
        elif fmt == 'single':
            write_function = write_float
        else:
            write_function = write_double
    else:
        if fmt == 'single':
            write_function = write_complex64
        elif fmt == 'double':
            write_function = write_complex128
        else:
            raise ValueError('only "single" and "double" supported for '
                             'writing complex data')

    if inv_comp is not None:
        buf = np.dot(inv_comp / np.ravel(cals)[:, None], buf)
    else:
        buf = buf / np.ravel(cals)[:, None]

    write_function(fid, FIFF.FIFF_DATA_BUFFER, buf)
testing if the handle argument value is correctly used in
dataset/ETHPy150Open mne-tools/mne-python/mne/io/base.py/_write_raw_buffer--crossover with--dataset/ETHPy150Open eoyilmaz/anima/tests/previs/test_shot_extension.py/ShotExtensionTestCase.test_set_handle_handle_argument_is_working_properly