code: def read_dig_hpts(fname, unit="mm"):
      """Read historical ``.hpts`` MNE-C files.
  
      Parameters
      ----------
      fname : path-like
          The filepath of .hpts file.
      unit : ``'m'`` | ``'cm'`` | ``'mm'``
          Unit of the positions. Defaults to ``'mm'``.
  
      Returns
      -------
      montage : instance of DigMontage
          The montage.
  
      See Also
      --------
      DigMontage
      read_dig_captrak
      read_dig_dat
      read_dig_egi
      read_dig_fif
      read_dig_localite
      read_dig_polhemus_isotrak
      make_dig_montage
  
      Notes
      -----
      The hpts format digitzer data file may contain comment lines starting
      with the pound sign (#) and data lines of the form::
  
           <*category*> <*identifier*> <*x/mm*> <*y/mm*> <*z/mm*>
  
      where:
  
      ``<*category*>``
          defines the type of points. Allowed categories are: ``hpi``,
          ``cardinal`` (fiducial), ``eeg``, and ``extra`` corresponding to
          head-position indicator coil locations, cardinal landmarks, EEG
          electrode locations, and additional head surface points,
          respectively.
  
      ``<*identifier*>``
          identifies the point. The identifiers are usually sequential
          numbers. For cardinal landmarks, 1 = left auricular point,
          2 = nasion, and 3 = right auricular point. For EEG electrodes,
          identifier = 0 signifies the reference electrode.
  
      ``<*x/mm*> , <*y/mm*> , <*z/mm*>``
          Location of the point, usually in the head coordinate system
          in millimeters. If your points are in [m] then unit parameter can
          be changed.
  
      For example::
  
          cardinal    2    -5.6729  -12.3873  -30.3671
          cardinal    1    -37.6782  -10.4957   91.5228
          cardinal    3    -131.3127    9.3976  -22.2363
          hpi    1    -30.4493  -11.8450   83.3601
          hpi    2    -122.5353    9.2232  -28.6828
          hpi    3    -6.8518  -47.0697  -37.0829
          hpi    4    7.3744  -50.6297  -12.1376
          hpi    5    -33.4264  -43.7352  -57.7756
          eeg    FP1  3.8676  -77.0439  -13.0212
          eeg    FP2  -31.9297  -70.6852  -57.4881
          eeg    F7  -6.1042  -68.2969   45.4939
          ...
      """
      from ._standard_montage_utils import _str, _str_names
  
      fname = _check_fname(fname, overwrite="read", must_exist=True)
      _scale = _check_unit_and_get_scaling(unit)
  
      out = np.genfromtxt(
          fname, comments="#", dtype=(_str, _str, "f8", "f8", "f8")
      )
      kind, label = _str_names(out["f0"]), _str_names(out["f1"])
      kind = [k.lower() for k in kind]
      xyz = np.array([out["f%d" % ii] for ii in range(2, 5)]).T
      xyz *= _scale
      del _scale
      fid_idx_to_label = {"1": "lpa", "2": "nasion", "3": "rpa"}
      fid = {
          fid_idx_to_label[label[ii]]: this_xyz
          for ii, this_xyz in enumerate(xyz)
          if kind[ii] == "cardinal"
      }
      ch_pos = {
          label[ii]: this_xyz
          for ii, this_xyz in enumerate(xyz)
          if kind[ii] == "eeg"
      }
      hpi = np.array(
          [
              this_xyz
              for ii, this_xyz in enumerate(xyz)
              if kind[ii] == "hpi"
          ]
      )
      hpi.shape = (-1, 3)  # in case it's empty
      hsp = np.array(
          [
              this_xyz
              for ii, this_xyz in enumerate(xyz)
              if kind[ii] == "extra"
          ]
      )
      hsp.shape = (-1, 3)  # in case it's empty
      return make_dig_montage(ch_pos=ch_pos, **fid, hpi=hpi, hsp=hsp)
  
imports: import os.path
  import re
  from collections import OrderedDict
  from copy import deepcopy
  from dataclasses import dataclass
  import numpy
  from .._fiff._digitization import _coord_frame_const, _count_points_by_type, _ensure_fiducials_head, _format_dig_points, _get_data_as_dict_from_dig, _get_dig_eeg, _get_fid_coords, _make_dig_points, _read_dig_fif, write_dig
  from .._fiff.constants import CHANNEL_LOC_ALIASES, FIFF
  from .._fiff.meas_info import create_info
  from .._fiff.open import fiff_open
  from .._fiff.pick import _picks_to_idx, channel_type, pick_types
  from .._freesurfer import get_mni_fiducials
  from ..defaults import HEAD_SIZE_DEFAULT
  from ..transforms import Transform, _ensure_trans, _fit_matched_points, _frame_to_str, _quat_to_affine, _sph_to_cart, _topo_to_sph, _verbose_frames, apply_trans, get_ras_to_neuromag_trans
  from ..utils import _check_fname, _check_option, _on_missing, _pl, _validate_type, copy_function_doc_to_method_doc, fill_doc, verbose, warn
  from ..utils.docs import docdict
  from ..viz import plot_montage
  from ._dig_montage_utils import _parse_brainvision_dig_montage, _read_dig_montage_egi
label_desc: Use image node_id 8 for calling a global function with example usage: read_dig_hpts(fname, unit) and returns: make_dig_montage