def legal_date(year, month, day):
if month == <NUM_LIT:2>:<EOL><INDENT>daysinmonth = <NUM_LIT> if isleap(year) else <NUM_LIT><EOL><DEDENT>else:<EOL><INDENT>daysinmonth = <NUM_LIT:30> if month in HAVE_30_DAYS else <NUM_LIT><EOL><DEDENT>if not (<NUM_LIT:0> < day <= daysinmonth):<EOL><INDENT>raise ValueError("<STR_LIT>".format(month, day))<EOL><DEDENT>return True<EOL>
Check if this is a legal date in the Gregorian calendar