def _backup_to_tag(pason, time):
    """Finds the last time that the bit tagged bottom before `time`
    
    Parameters
    ----------
    pason : PasonData
        A `:obj:PasonData` object
    time : datetime
        `:obj:datetime` object representing a time following a bottom tag.
    
    Returns
    -------
    datetime
        `:obj:datetime` object representing the time of the last bottom tag before `time`
    
    Raises
    ------
    UnexpectedData
        Raised if 'bit_depth' or 'hole_depth' aren't in `pason.data`

    """
    if 'bit_depth' not in pason.data.columns or 'hole_depth' not in pason.data.columns:
        raise ValueError(f'{pason.filename} must contain Bit Depth AND Hole Depths to find the last bottom tag!')
    
    i = int((pason.data['yyyy/mm/dd_hh:mm:ss'] >= time).argmax())

    # Make a list of off-bottom values ending at the step test
    off_bottom = pason.data['hole_depth'].iloc[:i] - pason.data['bit_depth'].iloc[:i]

    # Reverse the off bottom signal and find the first non-zero off bottom 
    last_off_bottom_idx = int((off_bottom>1)[::-1].idxmax())

    return pason.data['yyyy/mm/dd_hh:mm:ss'].iloc[last_off_bottom_idx]