code: def _write_morph_map_(fid, subject_from, subject_to, mmap_1, mmap_2):
      assert len(mmap_1) == 2
      hemis = [
          FIFF.FIFFV_MNE_SURF_LEFT_HEMI,
          FIFF.FIFFV_MNE_SURF_RIGHT_HEMI,
      ]
      for m, hemi in zip(mmap_1, hemis):
          start_block(fid, FIFF.FIFFB_MNE_MORPH_MAP)
          write_string(fid, FIFF.FIFF_MNE_MORPH_MAP_FROM, subject_from)
          write_string(fid, FIFF.FIFF_MNE_MORPH_MAP_TO, subject_to)
          write_int(fid, FIFF.FIFF_MNE_HEMI, hemi)
          write_float_sparse_rcs(fid, FIFF.FIFF_MNE_MORPH_MAP, m)
          end_block(fid, FIFF.FIFFB_MNE_MORPH_MAP)
      # don't write mmap_2 if it is identical (subject_to == subject_from)
      if mmap_2 is not None:
          assert len(mmap_2) == 2
          for m, hemi in zip(mmap_2, hemis):
              start_block(fid, FIFF.FIFFB_MNE_MORPH_MAP)
              write_string(
                  fid, FIFF.FIFF_MNE_MORPH_MAP_FROM, subject_to
              )
              write_string(
                  fid, FIFF.FIFF_MNE_MORPH_MAP_TO, subject_from
              )
              write_int(fid, FIFF.FIFF_MNE_HEMI, hemi)
              write_float_sparse_rcs(fid, FIFF.FIFF_MNE_MORPH_MAP, m)
              end_block(fid, FIFF.FIFFB_MNE_MORPH_MAP)
  
file_path: mne-python/mne/morph_map.py
imports: import os
  import numpy
  from scipy.sparse import csr_matrix, eye
  from ._fiff.constants import FIFF
  from ._fiff.open import fiff_open
  from ._fiff.tag import find_tag
  from ._fiff.tree import dir_tree_find
  from ._fiff.write import end_block, start_and_end_file, start_block, write_float_sparse_rcs, write_int, write_string
  from .surface import _compute_nearest, _find_nearest_tri_pts, _get_tri_supp_geom, _normalize_vectors, _triangle_neighbors, read_surface
  from .utils import get_subjects_dir, logger, verbose, warn
label_desc: Use image node_id 4 for calling a global function with example usage: _write_morph_map_(fid, subject_from, subject_to, mmap_1, mmap_2) without return types