code: def _read_xyz(fname):
      """Import EEG channel locations from CSV, TSV, or XYZ files.
  
      CSV and TSV files should have columns 4 columns containing
      ch_name, x, y, and z. Each row represents one channel.
      XYZ files should have 5 columns containing
      count, x, y, z, and ch_name. Each row represents one channel
      CSV files should be separated by commas, TSV and XYZ files should be
      separated by tabs.
  
      Parameters
      ----------
      fname : str
          Name of the file to read channel locations from.
  
      Returns
      -------
      montage : instance of DigMontage
          The montage.
      """
      ch_names = []
      pos = []
      file_format = op.splitext(fname)[1].lower()
      with open(fname) as f:
          if file_format != ".xyz":
              f.readline()  # skip header
          delimiter = "," if file_format == ".csv" else "\t"
          for row in csv.reader(f, delimiter=delimiter):
              if file_format == ".xyz":
                  _, x, y, z, ch_name, *_ = row
                  ch_name = (
                      ch_name.strip()
                  )  # deals with variable tab size
              else:
                  ch_name, x, y, z, *_ = row
              ch_names.append(ch_name)
              pos.append((x, y, z))
      d = _check_dupes_odict(ch_names, np.array(pos, dtype=float))
      return make_dig_montage(ch_pos=d)
  
imports: import csv
  import os.path
  from collections import OrderedDict
  from functools import partial
  import numpy
  from .._freesurfer import get_mni_fiducials
  from ..transforms import _sph_to_cart
  from ..utils import _pl, _soft_import, warn
  from .None import __file__
  from .montage import make_dig_montage
label_desc: Use image node_id 15 for calling a global function with example usage: _read_xyz(fname) and returns: make_dig_montage