def _CheckDate(date):
 if isinstance(date, datetime.datetime):
  if ((date < MIN_DATE) or (date > MAX_DATE)):
   raise TypeError(('date must be between %s and %s (got %s)' % (MIN_DATE, MAX_DATE, date)))
 elif isinstance(date, datetime.date):
  if ((date < MIN_DATE.date()) or (date > MAX_DATE.date())):
   raise TypeError(('date must be between %s and %s (got %s)' % (MIN_DATE, MAX_DATE, date)))
 else:
  raise TypeError('date must be datetime.datetime or datetime.date')
 return date

def _CheckDate ( date ) : if isinstance ( date , datetime . datetime ) : if ( ( date < MIN_DATE ) or ( date > MAX_DATE ) ) : raise TypeError ( ( 'date must be between %s and %s (got %s)' % ( MIN_DATE , MAX_DATE , date ) ) ) elif isinstance ( date , datetime . date ) : if ( ( date < MIN_DATE . date ( ) ) or ( date > MAX_DATE . date ( ) ) ) : raise TypeError ( ( 'date must be between %s and %s (got %s)' % ( MIN_DATE , MAX_DATE , date ) ) ) else : raise TypeError ( 'date must be datetime.datetime or datetime.date' ) return date
checks the date is in the correct range .