<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_trips( feed: "Feed", date: Optional[str] = None, time: Optional[str] = None ) -> DataFrame: """ Return a subset of ``feed.trips``. Parameters feed : Feed date : string YYYYMMDD date string time : string HH:MM:SS time string, possibly with HH > 23 Returns ------- DataFrame The subset of ``feed.trips`` containing trips active (starting) on the given date at the given time. If no date or time are specified, then return the entire ``feed.trips``. """

    if feed.trips is None or date is None:
        return feed.trips

    f = feed.trips.copy()
    f["is_active"] = f["trip_id"].map(
        lambda trip_id: feed.is_active_trip(trip_id, date)
    )
    f = f[f["is_active"]].copy()
    del f["is_active"]

    if time is not None:
        # Get trips active during given time
        g = pd.merge(f, feed.stop_times[["trip_id", "departure_time"]])

        def F(group):
            d = {}
            start = group["departure_time"].dropna().min()
            end = group["departure_time"].dropna().max()
            try:
                result = start <= time <= end
            except TypeError:
                result = False
            d["is_active"] = result
            return pd.Series(d)

        h = g.groupby("trip_id").apply(F).reset_index()
        f = pd.merge(f, h[h["is_active"]])
        del f["is_active"]

    return f