def is_available(time, duration, availabilities):
if duration == <NUM_LIT:30>:<EOL><INDENT>return time in availabilities<EOL><DEDENT>elif duration == <NUM_LIT>:<EOL><INDENT>second_half_hour_time = increment_time_by_thirty_mins(time)<EOL>return time in availabilities and second_half_hour_time in availabilities<EOL><DEDENT>raise Exception('<STR_LIT>'.format(duration))<EOL>
Helper function to check if the given time and duration fits within a known set of availability windows.
Duration is assumed to be one of 30, 60 (meaning minutes).  Availabilities is expected to contain entries of the format HH:MM.