code: def _ensure_fiducials_head(dig):
      # Ensure that there are all three fiducials in the head coord frame
      fids = dict()
      for d in dig:
          if d["kind"] == FIFF.FIFFV_POINT_CARDINAL:
              name = _cardinal_ident_mapping.get(d["ident"], None)
              if name is not None:
                  fids[name] = d
      radius = None
      mults = dict(
          lpa=[-1, 0, 0],
          rpa=[1, 0, 0],
          nasion=[0, 1, 0],
      )
      for ident, name in _cardinal_ident_mapping.items():
          if name not in fids:
              if radius is None:
                  radius = [
                      np.linalg.norm(d["r"])
                      for d in dig
                      if d["coord_frame"] == FIFF.FIFFV_COORD_HEAD
                      and not np.isnan(d["r"]).any()
                  ]
                  if not radius:
                      return  # can't complete, no head points
                  radius = np.mean(radius)
              dig.append(
                  DigPoint(
                      kind=FIFF.FIFFV_POINT_CARDINAL,
                      ident=ident,
                      r=np.array(mults[name], float) * radius,
                      coord_frame=FIFF.FIFFV_COORD_HEAD,
                  )
              )
  
imports: import heapq
  from collections import Counter
  import numpy
  from ..utils import Bunch, _check_fname, _validate_type, logger, verbose, warn
  from .constants import FIFF, _coord_frame_named
  from .tag import read_tag
  from .tree import dir_tree_find
  from .write import start_and_end_file, write_dig_points
label_desc: Use image node_id 6 for calling a global function with example usage: _ensure_fiducials_head(dig) without return types