def METHOD_NAME(dt: datetime.datetime) -> int:
    if len(SEASONS) == 0:
        init_seasons()
    if dt < SEASONS[0].start_date:
        raise InvalidDataException("Can't get a season from {dt} because it is before PD began")
    for s in SEASONS:
        if s.start_date > dt:
            return s.id - 1
    return SEASONS[-1].id