code: def write_coord_trans(fid, trans):
      """Write a coordinate transformation structure."""
      data_size = 4 * 2 * 12 + 4 * 2
      fid.write(np.array(FIFF.FIFF_COORD_TRANS, dtype=">i4").tobytes())
      fid.write(
          np.array(FIFF.FIFFT_COORD_TRANS_STRUCT, dtype=">i4").tobytes()
      )
      fid.write(np.array(data_size, dtype=">i4").tobytes())
      fid.write(np.array(FIFF.FIFFV_NEXT_SEQ, dtype=">i4").tobytes())
      fid.write(np.array(trans["from"], dtype=">i4").tobytes())
      fid.write(np.array(trans["to"], dtype=">i4").tobytes())
  
      #   The transform...
      rot = trans["trans"][:3, :3]
      move = trans["trans"][:3, 3]
      fid.write(np.array(rot, dtype=">f4").tobytes())
      fid.write(np.array(move, dtype=">f4").tobytes())
  
      #   ...and its inverse
      trans_inv = np.linalg.inv(trans["trans"])
      rot = trans_inv[:3, :3]
      move = trans_inv[:3, 3]
      fid.write(np.array(rot, dtype=">f4").tobytes())
      fid.write(np.array(move, dtype=">f4").tobytes())
  
imports: import os.path
  import re
  import time
  import uuid
  from contextlib import contextmanager
  from gzip import GzipFile
  import numpy
  from scipy.sparse import csc_matrix, csr_matrix
  from ..utils import _file_like, _validate_type, logger
  from ..utils.numerics import _cal_to_julian
  from .constants import FIFF
label_desc: Use image node_id 30 for calling a global function with example usage: write_coord_trans(fid, trans) without return types