selected_date = date(some_year, some_month, some_day)
if selected_date.month == 12:
    last_day_selected_month = date(selected_date.year, selected_date.month, 31)
python's datetime and end of the month