code: def _convert_comp_data(res4):
      """Convert the compensation data into named matrices."""
      if res4["ncomp"] == 0:
          return
      # Sort the coefficients in our favorite order
      res4["comp"] = sorted(res4["comp"], key=_comp_sort_keys)
      # Check that all items for a given compensation type have the correct
      # number of channels
      _check_comp(res4["comp"])
      # Create named matrices
      first = 0
      kind = -1
      comps = list()
      for k in range(len(res4["comp"])):
          if res4["comp"][k]["coeff_type"] != kind:
              if k > 0:
                  comps.append(
                      _conv_comp(
                          res4["comp"], first, k - 1, res4["chs"]
                      )
                  )
              kind = res4["comp"][k]["coeff_type"]
              first = k
      comps.append(_conv_comp(res4["comp"], first, k, res4["chs"]))
      return comps
  
imports: import os.path
  from calendar import timegm
  from time import strptime
  import numpy
  from ..._fiff.constants import FIFF
  from ..._fiff.ctf_comp import _add_kind, _calibrate_comp
  from ..._fiff.meas_info import _empty_info
  from ..._fiff.write import get_new_file_id
  from ...annotations import Annotations
  from ...transforms import _coord_frame_name, apply_trans, combine_transforms, invert_transform
  from ...utils import _clean_names, logger, warn
  from .constants import CTF
label_desc: Use image node_id 10 for calling a global function with example usage: _convert_comp_data(res4) and returns: comps