code: def write_ctf_comp(fid, comps):
      """Write the CTF compensation data into a fif file.
  
      Parameters
      ----------
      fid : file
          The open FIF file descriptor
  
      comps : list
          The compensation data to write
      """
      if len(comps) <= 0:
          return
  
      #  This is very simple in fact
      start_block(fid, FIFF.FIFFB_MNE_CTF_COMP)
      for comp in comps:
          start_block(fid, FIFF.FIFFB_MNE_CTF_COMP_DATA)
          #    Write the compensation kind
          write_int(fid, FIFF.FIFF_MNE_CTF_COMP_KIND, comp["ctfkind"])
          if comp.get("save_calibrated", False):
              write_int(
                  fid,
                  FIFF.FIFF_MNE_CTF_COMP_CALIBRATED,
                  comp["save_calibrated"],
              )
  
          if not comp.get("save_calibrated", True):
              # Undo calibration
              comp = deepcopy(comp)
              data = (
                  (1.0 / comp["rowcals"][:, None])
                  * comp["data"]["data"]
                  * (1.0 / comp["colcals"][None, :])
              )
              comp["data"]["data"] = data
          write_named_matrix(
              fid, FIFF.FIFF_MNE_CTF_COMP_DATA, comp["data"]
          )
          end_block(fid, FIFF.FIFFB_MNE_CTF_COMP_DATA)
  
      end_block(fid, FIFF.FIFFB_MNE_CTF_COMP)
  
file_path: mne-python/mne/_fiff/ctf_comp.py
imports: from copy import deepcopy
  import numpy
  from ..utils import _pl, logger, verbose
  from .constants import FIFF
  from .matrix import _read_named_matrix, write_named_matrix
  from .tag import read_tag
  from .tree import dir_tree_find
  from .write import end_block, start_block, write_int
label_desc: Use image node_id 5 for calling a global function with example usage: write_ctf_comp(fid, comps) without return types