<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_stops( feed: "Feed", date: Optional[str] = None, trip_id: Optional[str] = None, route_id: Optional[str] = None, *, in_stations: bool = False, ) -> DataFrame: """ Return a section of ``feed.stops``. Parameters feed : Feed date : string YYYYMMDD string; restricts the output to stops active (visited by trips) on the date trip_id : string ID of a trip in ``feed.trips``; restricts output to stops visited by the trip route_id : string ID of route in ``feed.routes``; restricts output to stops visited by the route in_stations : boolean If ``True``, then restricts output to stops in stations if station data is available in ``feed.stops`` Returns ------- DataFrame A subset of ``feed.stops`` defined by the parameters above Notes ----- Assume the following feed attributes are not ``None``: - ``feed.stops`` - Those used in :func:`.stop_times.get_stop_times` """

    s = feed.stops.copy()
    if date is not None:
        A = feed.get_stop_times(date)["stop_id"]
        s = s[s["stop_id"].isin(A)].copy()
    if trip_id is not None:
        st = feed.stop_times.copy()
        B = st[st["trip_id"] == trip_id]["stop_id"]
        s = s[s["stop_id"].isin(B)].copy()
    elif route_id is not None:
        A = feed.trips[feed.trips["route_id"] == route_id]["trip_id"]
        st = feed.stop_times.copy()
        B = st[st["trip_id"].isin(A)]["stop_id"]
        s = s[s["stop_id"].isin(B)].copy()
    if in_stations and set(["location_type", "parent_station"]) <= set(
        s.columns
    ):
        s = s[(s["location_type"] != 1) & (s["parent_station"].notnull())]

    return s