code: def _merge_nirs_data(data, merged_names):
      """Merge data from multiple nirs channel using the mean.
  
      Channel names that have an x in them will be merged. The first channel in
      the name is replaced with the mean of all listed channels. The other
      channels are removed.
  
      Parameters
      ----------
      data : array, shape = (n_channels, ..., n_times)
          Data for channels.
      merged_names : list
          List of strings containing the channel names. Channels that are to be
          merged contain an x between them.
  
      Returns
      -------
      data : array
          Data for channels with requested channels merged. Channels used in the
          merge are removed from the array.
      """
      to_remove = np.empty(0, dtype=np.int32)
      for idx, ch in enumerate(merged_names):
          if "x" in ch:
              indices = np.empty(0, dtype=np.int32)
              channels = ch.split("x")
              for sub_ch in channels[1:]:
                  indices = np.append(
                      indices, merged_names.index(sub_ch)
                  )
              data[idx] = np.mean(data[np.append(idx, indices)], axis=0)
              to_remove = np.append(to_remove, indices)
      to_remove = np.unique(to_remove)
      for rem in sorted(to_remove, reverse=True):
          del merged_names[rem]
          data = np.delete(data, rem, 0)
      return data, merged_names
  
imports: import logging
  from collections import defaultdict
  from itertools import combinations
  from pathlib import Path
  import numpy
  from scipy.spatial.distance import pdist, squareform
  from .._fiff.constants import FIFF
  from .._fiff.meas_info import Info
  from .._fiff.pick import _FNIRS_CH_TYPES_SPLIT, _picks_to_idx, pick_types
  from ..transforms import _cart_to_sph, _pol_to_cart
  from ..utils import _check_ch_locs, _check_fname, _check_option, _check_sphere, _clean_names, fill_doc, logger, warn
  from ..viz.topomap import plot_layout
  from .channels import _get_ch_info
label_desc: Use image node_id 17 for calling a global function with example usage: _merge_nirs_data(data, merged_names) and returns: data,  merged_names