I found an answer to getting the last day of months: https://stackoverflow.com/a/13565185/11661097
This answer is in python 2 and in python 3 when I run this code I get this error:
print(self.last_day_of_month(start))
TypeError: last_day_of_month() takes 1 positional argument but 2 were given
start is a datetime object (datetime.date(someyear, somemonth, someday) so it should be exactly the same as the answer given in the question.
Is this because the answer is in python 2? If so, how would I rewrite it so it works in python 3?