code: def write_dig(
      fname, pts, coord_frame=None, *, overwrite=False, verbose=None
  ):
      """Write digitization data to a FIF file.
  
      Parameters
      ----------
      fname : path-like
          Destination file name.
      pts : iterator of dict
          Iterator through digitizer points. Each point is a dictionary with
          the keys 'kind', 'ident' and 'r'.
      coord_frame : int | str | None
          If all the points have the same coordinate frame, specify the type
          here. Can be None (default) if the points could have varying
          coordinate frames.
      %(overwrite)s
  
          .. versionadded:: 1.0
      %(verbose)s
  
          .. versionadded:: 1.0
      """
      from ..transforms import _to_const
  
      fname = _check_fname(fname, overwrite=overwrite)
      if coord_frame is not None:
          coord_frame = _to_const(coord_frame)
          pts_frames = {
              pt.get("coord_frame", coord_frame) for pt in pts
          }
          bad_frames = pts_frames - {coord_frame}
          if len(bad_frames) > 0:
              raise ValueError(
                  "Points have coord_frame entries that are incompatible with "
                  "coord_frame=%i: %s."
                  % (coord_frame, str(tuple(bad_frames)))
              )
  
      with start_and_end_file(fname) as fid:
          write_dig_points(
              fid, pts, block=True, coord_frame=coord_frame
          )
  
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 5 for calling a global function with example usage: write_dig(fname, pts, coord_frame) without return types