code: def _prepare_rerp_data(raw, events, picks=None, decim=1):
      """Prepare events and data, primarily for `linear_regression_raw`."""
      picks = _picks_to_idx(raw.info, picks)
      info = pick_info(raw.info, picks)
      decim = int(decim)
      with info._unlock():
          info["sfreq"] /= decim
      data, times = raw[:]
      data = data[picks, ::decim]
      if len(set(events[:, 0])) < len(events[:, 0]):
          raise ValueError(
              "`events` contains duplicate time points. Make "
              "sure all entries in the first column of `events` "
              "are unique."
          )
  
      events = events.copy()
      events[:, 0] -= raw.first_samp
      events[:, 0] //= decim
      if len(set(events[:, 0])) < len(events[:, 0]):
          raise ValueError(
              "After decimating, `events` contains duplicate time "
              "points. This means some events are too closely "
              "spaced for the requested decimation factor. Choose "
              "different events, drop close events, or choose a "
              "different decimation factor."
          )
  
      return data, info, events
  
file_path: mne-python/mne/stats/regression.py
imports: from collections import namedtuple
  from inspect import isgenerator
  import numpy
  from scipy import linalg, sparse, stats
  from .._fiff.pick import _picks_to_idx, pick_info, pick_types
  from ..epochs import BaseEpochs
  from ..evoked import Evoked, EvokedArray
  from ..source_estimate import SourceEstimate
  from ..utils import _reject_data_segments, fill_doc, logger, warn
label_desc: Use image node_id 4 for calling a global function with example usage: _prepare_rerp_data(raw, events, picks, decim) and returns: data,  info,  events