code: def _assert_similarity(
      raw, other, n_events, ratio_other, events_raw=None
  ):
      if events_raw is None:
          events_raw = find_events(raw, output="onset")
      events_other = find_events(other, output="onset")
      assert len(events_raw) == len(events_other) == n_events
      kwargs = dict(baseline=None, tmin=0, tmax=0.2)
      evoked_raw = Epochs(raw, events_raw, **kwargs).average()
      evoked_other = Epochs(other, events_other, **kwargs).average()
      assert evoked_raw.nave == evoked_other.nave == len(events_raw)
      assert (
          len(evoked_raw.data) == len(evoked_other.data) == 1
      )  # just EEG
      if 0.99 <= ratio_other <= 1.01:  # when drift is not too large
          corr = np.corrcoef(evoked_raw.data[0], evoked_other.data[0])[
              0, 1
          ]
          assert 0.9 <= corr <= 1.0
      return evoked_raw, events_raw, evoked_other, events_other
  
file_path: mne-python/mne/preprocessing/tests/test_realign.py
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose
  from scipy.interpolate import interp1d
  from mne import Annotations, Epochs, create_info, find_events
  from mne.io import RawArray
  from mne.preprocessing import realign_raw
label_desc: Use image node_id 2 for calling a global function with example usage: _assert_similarity(raw, other, n_events, ratio_other, events_raw) and returns: evoked_raw,  events_raw,  evoked_other,  events_other