def month_name(no_month): if isinstance(no_month, datetime): no_month = no_month.month return calendar.month_name[no_month]