def decrement_month(date):
 if (date.day != 1):
  raise ValueError('Input must be truncated to the 1st of the month.')
 date -= datetime.timedelta(days=1)
 return date.replace(day=1)

def decrement_month ( date ) : if ( date . day != 1 ) : raise ValueError ( 'Input must be truncated to the 1st of the month.' ) date -= datetime . timedelta ( days = 1 ) return date . replace ( day = 1 )
given a truncated datetime .