Given a list of GTFSR feeds (FeedMessage instances), a GTFS feed
    (GTFSTK Feed instance), and a date (YYYYMMDD string), return
    a DataFrame of GTFS stop times for trips scheduled on the given date
    and containing two extra columns, ``'arrival_delay'`` and
    ``'departure_delay'``, which are delay values in seconds
    for that stop time according to the GTFSR feeds given.

    If no GTFSR feeds are given or if their dates don't alight with
    the given date, then the resulting delay fields will be all NaN.

def build_augmented_stop_times(gtfsr_feeds, gtfs_feed, date):
    """
    Given a list of GTFSR feeds (FeedMessage instances), a GTFS feed
    (GTFSTK Feed instance), and a date (YYYYMMDD string), return
    a DataFrame of GTFS stop times for trips scheduled on the given date
    and containing two extra columns, ``'arrival_delay'`` and
    ``'departure_delay'``, which are delay values in seconds
    for that stop time according to the GTFSR feeds given.

    If no GTFSR feeds are given or if their dates don't alight with
    the given date, then the resulting delay fields will be all NaN.
    """
    # Get scheduled stop times for date
    st = gt.get_stop_times(gtfs_feed, date)

    # Get GTFSR timestamps pertinent to date.
    # Use datetime format YYYYMMDDHHMMSS to be compatible with GTFS dates
    datetime_format = '%Y%m%d%H%M%S'
    start_time = '000000'
    start_datetime = date + start_time
    # Plus 20 minutes fuzz:
    end_time = gt.timestr_to_seconds(st['departure_time'].max()) + 20*60
    if end_time >= 24*3600:
        end_date = str(int(date) + 1)
    else:
        end_date = date
    end_time = gt.timestr_to_seconds(end_time, inverse=True)
    end_time = gt.timestr_mod24(end_time)
    end_time = end_time.replace(':', '')
    end_datetime = end_date + end_time

    # Extract delays
    delays_frames = [extract_delays(f) for f in gtfsr_feeds
      if start_datetime <= get_timestamp_str(f, datetime_format)
      <= end_datetime]

    # Combine delays
    delays = combine_delays(delays_frames)
    if delays.empty:
        # Assign NaNs to delays
        ast = (
            st
            .assign(arrival_delay = np.nan)
            .assign(departure_delay = np.nan)
        )
    else:
        del delays['route_id']

        # Merge with stop times
        ast = st.merge(delays, how='left',
          on=['trip_id', 'stop_id', 'stop_sequence'])

    return ast.sort_values(['trip_id', 'stop_sequence'])