def get_events_by_tripI_and_dsut(self, trip_I, day_start_ut,<EOL>start_ut=None, end_ut=None):
<EOL>assert day_start_ut <= start_ut<EOL>assert day_start_ut <= end_ut<EOL>assert start_ut <= end_ut<EOL>events = []<EOL>if not self.tripI_takes_place_on_dsut(trip_I, day_start_ut):<EOL><INDENT>return events<EOL><DEDENT>query = """<STR_LIT>"""<EOL>params = [day_start_ut, day_start_ut,<EOL>trip_I]<EOL>if start_ut:<EOL><INDENT>query += "<STR_LIT>"<EOL>params += [start_ut, day_start_ut]<EOL><DEDENT>if end_ut:<EOL><INDENT>query += "<STR_LIT>"<EOL>params += [end_ut, day_start_ut]<EOL><DEDENT>query += "<STR_LIT>"<EOL>cur = self.conn.cursor()<EOL>rows = cur.execute(query, params)<EOL>stop_data = list(rows)<EOL>for i in range(len(stop_data) - <NUM_LIT:1>):<EOL><INDENT>event = {<EOL>"<STR_LIT>": stop_data[i][<NUM_LIT:0>],<EOL>"<STR_LIT>": stop_data[i + <NUM_LIT:1>][<NUM_LIT:0>],<EOL>"<STR_LIT>": stop_data[i][<NUM_LIT:2>],<EOL>"<STR_LIT>": stop_data[i + <NUM_LIT:1>][<NUM_LIT:1>]<EOL>}<EOL>events.append(event)<EOL><DEDENT>return events<EOL>
Get trip data as a list of events (i.e. dicts).

Parameters
----------
trip_I : int
    shorthand index of the trip.
day_start_ut : int
    the start time of the day in unix time (seconds)
start_ut : int, optional
    consider only events that start after this time
    If not specified, this filtering is not applied.
end_ut : int, optional
    Consider only events that end before this time
    If not specified, this filtering is not applied.

Returns
-------
events: list of dicts
    each element contains the following data:
        from_stop: int (stop_I)
        to_stop: int (stop_I)
        dep_time_ut: int (in unix time)
        arr_time_ut: int (in unix time)