code: def _make_ecg(
      inst, start, stop, reject_by_annotation=False, verbose=None
  ):
      """Create ECG signal from cross channel average."""
      if not any(c in inst for c in ["mag", "grad"]):
          raise ValueError("Unable to generate artificial ECG channel")
      for ch in ["mag", "grad"]:
          if ch in inst:
              break
      logger.info(
          "Reconstructing ECG signal from {}".format(
              {"mag": "Magnetometers", "grad": "Gradiometers"}[ch]
          )
      )
      picks = pick_types(inst.info, meg=ch, eeg=False, ref_meg=False)
  
      # Handle start/stop
      msg = (
          "integer arguments for the start and stop parameters are "
          "not supported for Epochs and Evoked objects. Please "
          "consider using float arguments specifying start and stop "
          "time in seconds."
      )
      begin_param_name = "tmin"
      if isinstance(start, int_like):
          if isinstance(inst, BaseRaw):
              # Raw has start param, can just use int
              begin_param_name = "start"
          else:
              raise ValueError(msg)
  
      end_param_name = "tmax"
      if isinstance(start, int_like):
          if isinstance(inst, BaseRaw):
              # Raw has stop param, can just use int
              end_param_name = "stop"
          else:
              raise ValueError(msg)
  
      kwargs = {begin_param_name: start, end_param_name: stop}
  
      if isinstance(inst, BaseRaw):
          reject_by_annotation = (
              "omit" if reject_by_annotation else None
          )
          ecg, times = inst.get_data(
              picks,
              return_times=True,
              **kwargs,
              reject_by_annotation=reject_by_annotation,
          )
      elif isinstance(inst, BaseEpochs):
          ecg = np.hstack(inst.copy().get_data(picks, **kwargs))
          times = inst.times
      elif isinstance(inst, Evoked):
          ecg = inst.get_data(picks, **kwargs)
          times = inst.times
      return ecg.mean(0, keepdims=True), times
  
file_path: mne-python/mne/preprocessing/ecg.py
imports: import numpy
  from .._fiff.meas_info import create_info
  from .._fiff.pick import _picks_to_idx, pick_channels, pick_types
  from ..annotations import _annotations_starts_stops
  from ..epochs import BaseEpochs, Epochs
  from ..evoked import Evoked
  from ..filter import filter_data
  from ..io import BaseRaw, RawArray
  from ..utils import int_like, logger, sum_squared, verbose, warn
label_desc: Use image node_id 5 for calling a global function with example usage: _make_ecg(inst, start, stop, reject_by_annotation, verbose) and returns: ecg,  times