def _check_preload(inst, msg):
    """Ensure data are preloaded."""
    from ..epochs import BaseEpochs
    from ..evoked import Evoked
    from ..time_frequency import _BaseTFR
    if isinstance(inst, (_BaseTFR, Evoked)):
        pass
    else:
        name = 'epochs' if isinstance(inst, BaseEpochs) else 'raw'
        if not inst.preload:
            raise RuntimeError(
                'By default, MNE does not load data into main memory to conserve resources. '
                 + msg + 
                ' requires %s data to be loaded. Use preload=True (or string) in the constructor or %s.load_data().'
                 % (name, name))
