code: def _create_eeg_with_scaled_montage_units(in_fname, out_fname, scale):
      eeg = io.loadmat(
          in_fname, struct_as_record=False, squeeze_me=True
      )["EEG"]
  
      # test reading file with one event (read old version)
      # chanlocs = deepcopy(eeg.chanlocs)
      chanlocs = eeg.chanlocs
      xyz = np.empty((len(chanlocs), 3))
      labels = []
      for ch_i, loc in enumerate(chanlocs):
          xyz[ch_i] = [loc.X, loc.Y, loc.Z]
          labels.append(loc.labels)
      xyz *= scale
      chanlocs = np.rec.fromarrays(
          [labels, *xyz.T],
          names=["labels", "X", "Y", "Z"],
      )
  
      fdt = isinstance(eeg.data, str)
      if fdt:
          shutil.copyfile(
              in_fname.with_suffix(".fdt"),
              out_fname.with_suffix(".fdt"),
          )
      io.savemat(
          out_fname,
          {
              "EEG": {
                  "trials": eeg.trials,
                  "srate": eeg.srate,
                  "nbchan": eeg.nbchan,
                  "data": out_fname.with_suffix(".fdt").name
                  if fdt
                  else eeg.data,
                  "epoch": eeg.epoch,
                  "event": eeg.event,
                  "chanlocs": chanlocs,
                  "pnts": eeg.pnts,
              }
          },
          appendmat=False,
          oned_as="row",
      )
  
imports: import os
  import shutil
  from copy import deepcopy
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from scipy import io
  import mne
  from mne import read_epochs_eeglab, write_events
  from mne.annotations import events_from_annotations, read_annotations
  from mne.channels import read_custom_montage
  from mne.datasets import testing
  from mne.io import read_raw_eeglab
  from mne.io.eeglab._eeglab import _readmat
  from mne.io.eeglab.eeglab import _dol_to_lod, _get_montage_information
  from mne.io.tests.test_raw import _test_raw_reader
  from mne.utils import Bunch, _check_pymatreader_installed
label_desc: Use image node_id 12 for calling a global function with example usage: _create_eeg_with_scaled_montage_units(in_fname, out_fname, scale) without return types