def _valid_date_filter(self, service_id):
        def valid_date(day):
            serv = self._service(service_id)
            weekday = day.format('dddd').lower()
            day = day.date()  # convert from Arrow to datetime.date
            # schedule exceptions: 1 = added, 2 = removed
            return ((serv['start_date'] <= day <= serv['end_date']) and
                    (serv['exceptions'].get(day, 0) != 2) and
                    (serv[weekday] or serv['exceptions'].get(day, 0) == 1))
        return valid_date
dataset/ETHPy150Open spaceboats/busbus/busbus/provider/gtfs.py/GTFSArrivalGenerator._valid_date_filter/original