code: def _check_eeglab_fname(fname, dataname):
      """Check whether the filename is valid.
  
      Check if the file extension is ``.fdt`` (older ``.dat`` being invalid) or
      whether the ``EEG.data`` filename exists. If ``EEG.data`` file is absent
      the set file name with .set changed to .fdt is checked.
      """
      fmt = str(op.splitext(dataname)[-1])
      if fmt == ".dat":
          raise NotImplementedError(
              "Old data format .dat detected. Please update your EEGLAB "
              "version and resave the data in .fdt format"
          )
      elif fmt != ".fdt":
          raise OSError(
              "Expected .fdt file format. Found %s format" % fmt
          )
  
      basedir = op.dirname(fname)
      data_fname = op.join(basedir, dataname)
      if not op.exists(data_fname):
          fdt_from_set_fname = op.splitext(fname)[0] + ".fdt"
          if op.exists(fdt_from_set_fname):
              data_fname = fdt_from_set_fname
              msg = (
                  "Data file name in EEG.data ({}) is incorrect, the file "
                  "name must have changed on disk, using the correct file "
                  "name ({})."
              )
              warn(
                  msg.format(dataname, op.basename(fdt_from_set_fname))
              )
          elif not data_fname == fdt_from_set_fname:
              msg = (
                  "Could not find the .fdt data file, tried {} and {}."
              )
              raise FileNotFoundError(
                  msg.format(data_fname, fdt_from_set_fname)
              )
      return data_fname
  
imports: import os.path
  from os import PathLike
  from pathlib import Path
  import numpy
  from mne.utils.check import _check_option
  from ..._fiff._digitization import _ensure_fiducials_head
  from ..._fiff.constants import FIFF
  from ..._fiff.meas_info import create_info
  from ..._fiff.pick import _PICK_TYPES_KEYS
  from ..._fiff.utils import _find_channels, _read_segments_file
  from ...annotations import Annotations, read_annotations
  from ...channels import make_dig_montage
  from ...defaults import DEFAULTS
  from ...epochs import BaseEpochs
  from ...event import read_events
  from ...utils import Bunch, _check_fname, _check_head_radius, fill_doc, logger, verbose, warn
  from ..base import BaseRaw
  from ._eeglab import _readmat
label_desc: Use image node_id 1 for calling a global function with example usage: _check_eeglab_fname(fname, dataname) and returns: data_fname