def get_frame(epoch, step_size, frame_number):
    """
    Crop an epoch based on a frame number

    Args:
        epoch: mne.epochs.Epochs
            Epoch to crop
        steps_size: int
            Number of time frames per step
        frame_number: int
            Current frame number

    Returns:
        mne.epochs.Epochs:
            Cropped epochs for the given frame
    """
    times = epoch.times
    max_index = len(times)-1
    tmax = (frame_number+1)*step_size

    # make sure we don't go outside the possible range
    if(tmax > max_index):
        tmax = max_index

    return epoch.copy().crop(
        times[frame_number*step_size],
        times[tmax],
        include_tmax=True
    )