code: def corrupt(covmats, n_corrup_channels_max, rs):
      n_matrices, n_channels, _ = covmats.shape
      all_n_corrup_channels, all_corrup_channels = (
          np.zeros(n_matrices),
          [],
      )
      for i_matrix in range(n_matrices):
          n_corrupt_channels = rs.randint(
              n_corrup_channels_max + 1, size=1
          )
          corrup_channels = rs.choice(
              np.arange(0, n_channels),
              size=n_corrupt_channels,
              replace=False,
          )
          for i_channel in corrup_channels:
              covmats[i_matrix, i_channel] = np.nan
              covmats[i_matrix, :, i_channel] = np.nan
              all_corrup_channels.append(i_channel)
          all_n_corrup_channels[i_matrix] = n_corrupt_channels
      return covmats, all_n_corrup_channels, all_corrup_channels
  
imports: import numpy
  from matplotlib import pyplot
  import pandas
  import seaborn
  from pyriemann.datasets import make_covariances
  from pyriemann.utils.mean import mean_riemann, nanmean_riemann
  from pyriemann.utils.distance import distance_riemann
label_desc: Use image node_id 1 for calling a global function with example usage: corrupt(covmats, n_corrup_channels_max, rs) and returns: covmats,  all_n_corrup_channels,  all_corrup_channels