def valid_course_modules(course_module_list, master_course_key):
 course_chapters = get_course_chapters(master_course_key)
 if (course_chapters is None):
  return False
 return (set(course_module_list).intersection(set(course_chapters)) == set(course_module_list))

def valid_course_modules ( course_module_list , master_course_key ) : course_chapters = get_course_chapters ( master_course_key ) if ( course_chapters is None ) : return False return ( set ( course_module_list ) . intersection ( set ( course_chapters ) ) == set ( course_module_list ) )
function to validate that each element in the course_module_list belongs to the master course structure .