def extract_month_first_dates(input_list):
    output = []
last_key = None
for curr_date in input_list:
    date_key = curr_date.date.month, curr_date.date.year
if date_key != last_key:
    output.append(curr_date)
last_key = date_key
return output
Building a list of months by iterating between two dates in a list (Python)