code: def _get_filtered_cov(
      raw, picks, event_id, fmin, fmax, tmin, tmax, verbose
  ):
      """Private function to apply band-pass filter and estimate
      covariance matrix."""
  
      best_raw_filter = raw.copy().filter(
          fmin, fmax, method="iir", picks=picks, verbose=verbose
      )
  
      events, _ = events_from_annotations(
          best_raw_filter, event_id=event_id, verbose=verbose
      )
  
      epochs = Epochs(
          best_raw_filter,
          events,
          event_id,
          tmin,
          tmax,
          proj=True,
          picks=picks,
          baseline=None,
          preload=True,
          verbose=verbose,
      )
      labels = epochs.events[:, -1] - 2
  
      epochs_data = epochs.get_data(units="uV")
  
      cov_data = Covariances().transform(epochs_data)
  
      return cov_data, labels
  
imports: import numpy
  from mne import Epochs, events_from_annotations
  from pyriemann.estimation import Covariances
  from pyriemann.classification import class_distinctiveness
label_desc: Use image node_id 2 for calling a global function with example usage: _get_filtered_cov(raw, picks, event_id, fmin, fmax, tmin, tmax, verbose) and returns: cov_data,  labels