code: def _read_sfp(fname, head_size):
      """Read .sfp BESA/EGI files."""
      # fname has been already checked
      fid_names = ("FidNz", "FidT9", "FidT10")
      options = dict(dtype=(_str, "f4", "f4", "f4"))
      ch_names, xs, ys, zs = _safe_np_loadtxt(fname, **options)
      # deal with "headshape"
      mask = np.array(
          [ch_name == "headshape" for ch_name in ch_names], bool
      )
      hsp = np.stack([xs[mask], ys[mask], zs[mask]], axis=-1)
      mask = ~mask
      pos = np.stack([xs[mask], ys[mask], zs[mask]], axis=-1)
      ch_names = [ch_name for ch_name, m in zip(ch_names, mask) if m]
      ch_pos = _check_dupes_odict(ch_names, pos)
      del xs, ys, zs, ch_names
      # no one grants that fid names are there.
      nasion, lpa, rpa = (ch_pos.pop(n, None) for n in fid_names)
  
      if head_size is not None:
          scale = head_size / np.median(np.linalg.norm(pos, axis=-1))
          for value in ch_pos.values():
              value *= scale
          nasion = nasion * scale if nasion is not None else None
          lpa = lpa * scale if lpa is not None else None
          rpa = rpa * scale if rpa is not None else None
  
      return make_dig_montage(
          ch_pos=ch_pos,
          coord_frame="unknown",
          nasion=nasion,
          rpa=rpa,
          lpa=lpa,
          hsp=hsp,
      )
  
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 8 for calling a global function with example usage: _read_sfp(fname, head_size) and returns: make_dig_montage