code: def _make_compensator(info, grade):
      """Auxiliary function for make_compensator."""
      for k in range(len(info["comps"])):
          if info["comps"][k]["kind"] == grade:
              this_data = info["comps"][k]["data"]
  
              #   Create the preselector
              presel = np.zeros((this_data["ncol"], info["nchan"]))
              for col, col_name in enumerate(this_data["col_names"]):
                  ind = [
                      k
                      for k, ch in enumerate(info["ch_names"])
                      if ch == col_name
                  ]
                  if len(ind) == 0:
                      raise ValueError(
                          "Channel %s is not available in "
                          "data" % col_name
                      )
                  elif len(ind) > 1:
                      raise ValueError(
                          "Ambiguous channel %s" % col_name
                      )
                  presel[col, ind[0]] = 1.0
  
              #   Create the postselector (zero entries for channels not found)
              postsel = np.zeros((info["nchan"], this_data["nrow"]))
              for c, ch_name in enumerate(info["ch_names"]):
                  ind = [
                      k
                      for k, ch in enumerate(this_data["row_names"])
                      if ch == ch_name
                  ]
                  if len(ind) > 1:
                      raise ValueError("Ambiguous channel %s" % ch_name)
                  elif len(ind) == 1:
                      postsel[c, ind[0]] = 1.0
                  # else, don't use it at all (postsel[c, ?] = 0.0) by allocation
              this_comp = np.dot(
                  postsel, np.dot(this_data["data"], presel)
              )
              return this_comp
  
      raise ValueError(
          "Desired compensation matrix (grade = %d) not"
          " found" % grade
      )
  
imports: import numpy
  from ..utils import fill_doc
  from .constants import FIFF
label_desc: Use image node_id 3 for calling a global function with example usage: _make_compensator(info, grade) and returns: this_comp