def within_ndays_before(n):
    now = datetime.datetime.now()
    maxsec = n * 24 * 60 * 60

    def predicate(ev):
        date = ev.date.start
        if isinstance(date, datetime.date):
            date = datetime.datetime(*date.timetuple()[:3])
        return 0 <= total_seconds(now - date) <= maxsec
    return predicate
dataset/ETHPy150Open tkf/orgviz/orgviz/graphs.py/within_ndays_before/original