Library calendar tools. This one include a very interestings tools and features.
import calendar # weekday of first day of the month and number of days in month calendar.monthrange(2017,12) #[out]: (4,31) where 4=Friday