def _get_date_range(frequency, period_start, period_end):
 assert (frequency == 'months')
 if (frequency == 'months'):
  if (not (period_start or period_end)):
   cur_date = datetime.datetime.now()
   first_this_month = datetime.datetime(year=cur_date.year, month=cur_date.month, day=1, hour=0, minute=0, second=0)
   period_end = (first_this_month - datetime.timedelta(seconds=1))
   period_start = datetime.datetime(year=period_end.year, month=period_end.month, day=1)
  else:
   period_end = (period_end or (period_start + datetime.timedelta(days=30)))
   period_start = (period_start or (period_end - datetime.timedelta(days=30)))
 return (period_start, period_end)

def _get_date_range ( frequency , period_start , period_end ) : assert ( frequency == 'months' ) if ( frequency == 'months' ) : if ( not ( period_start or period_end ) ) : cur_date = datetime . datetime . now ( ) first_this_month = datetime . datetime ( year = cur_date . year , month = cur_date . month , day = 1 , hour = 0 , minute = 0 , second = 0 ) period_end = ( first_this_month - datetime . timedelta ( seconds = 1 ) ) period_start = datetime . datetime ( year = period_end . year , month = period_end . month , day = 1 ) else : period_end = ( period_end or ( period_start + datetime . timedelta ( days = 30 ) ) ) period_start = ( period_start or ( period_end - datetime . timedelta ( days = 30 ) ) ) return ( period_start , period_end )
hack function .