def member_to_beacon_proximity_fill_gaps(m2b, time_bins_size='1min',
                                        max_gap_size = 2):
    """ Fill gaps in a given member to beacon object
    Parameters
    ----------
    m2b : Member to beacon object

    time_bins_size : str
        The size of the time bins used for resampling.  Defaults to '1min'.

    max_gap_size : int
         this is the maximum number of consecutive NaN values to forward/backward fill

    Returns
    -------
    pd.DataFrame :
        The member-to-beacon proximity data, after filling gaps.
    """

    df = m2b.copy().reset_index()
    df = df.sort_values(by=['member', 'beacon', 'datetime'])
    df.set_index('datetime', inplace=True)

    df = df.groupby(['member', 'beacon']) \
        [['rssi', 'rssi_std','rssi_smooth_window_count']] \
        .resample(time_bins_size) \
        .fillna(method='ffill', limit=max_gap_size)

    df = df.reorder_levels(['datetime', 'member', 'beacon'], axis=0)\
        .dropna().sort_index()
    return df