nodes: 0, module; 1, function_definition; 2, function_name:get_config_dir; 3, parameters; 4, block; 5, identifier:path; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, for_statement; 16, return_statement; 17, identifier:pattern; 18, string:"*.config"; 19, identifier:configspec; 20, None; 21, identifier:allow_errors; 22, False; 23, comment:"""
  	Load an entire directory of configuration files, merging them into one.
  
  	This function will load multiple configuration files matching the given pattern,
  	in the given path, and merge them. The found files are first sorted alphabetically,
  	and then loaded and merged. A good practice is to use ConfigObj sections, for easy
  	loading of information like per-host configuration.
  
  	Parameters
  	----------
  	path: string
  		Absolute path to a directory of ConfigObj files
  	pattern: string
  		Globbing pattern used to find files. Defaults to *.config.
  	configspec: ConfigObj
  		Used to sanitize the values in the resulting ConfigObj. Validation errors are currently
  		not exposed to the caller.
  	allow_errors: boolean
  		If False, errors raised by ConfigObj are not caught.
  		If True, errors raise by ConfigObj are caught, and an error is logged using logger.
  	"""; 24, assignment; 25, call; 26, assignment; 27, assignment; 28, assignment; 29, identifier:filename; 30, identifier:files; 31, block; 32, identifier:config; 33, identifier:logger; 34, call; 35, attribute; 36, argument_list; 37, identifier:files; 38, call; 39, identifier:files; 40, call; 41, identifier:config; 42, call; 43, expression_statement; 44, try_statement; 45, if_statement; 46, expression_statement; 47, attribute; 48, argument_list; 49, identifier:logger; 50, identifier:debug; 51, call; 52, attribute; 53, argument_list; 54, identifier:sorted; 55, argument_list; 56, identifier:ConfigObj; 57, argument_list; 58, call; 59, block; 60, except_clause; 61, identifier:configspec; 62, block; 63, call; 64, identifier:logging; 65, identifier:getLogger; 66, identifier:__name__; 67, attribute; 68, argument_list; 69, call; 70, identifier:glob; 71, identifier:files; 72, attribute; 73, argument_list; 74, expression_statement; 75, identifier:ConfigObjError; 76, identifier:coe; 77, block; 78, expression_statement; 79, attribute; 80, argument_list; 81, string:"Loading all files matching {0} in {1}"; 82, identifier:format; 83, identifier:pattern; 84, identifier:path; 85, identifier:Globber; 86, argument_list; 87, identifier:logger; 88, identifier:debug; 89, call; 90, assignment; 91, expression_statement; 92, continue_statement; 93, call; 94, identifier:config; 95, identifier:merge; 96, identifier:conf; 97, identifier:path; 98, keyword_argument; 99, keyword_argument; 100, attribute; 101, argument_list; 102, identifier:conf; 103, call; 104, call; 105, attribute; 106, argument_list; 107, identifier:include; 108, list; 109, identifier:recursive; 110, False; 111, string:"- Loading config for {0}"; 112, identifier:format; 113, identifier:filename; 114, identifier:ConfigObj; 115, argument_list; 116, attribute; 117, argument_list; 118, identifier:conf; 119, identifier:validate; 120, call; 121, identifier:pattern; 122, identifier:filename; 123, keyword_argument; 124, identifier:logger; 125, identifier:error; 126, call; 127, identifier:Validator; 128, argument_list; 129, identifier:configspec; 130, identifier:configspec; 131, attribute; 132, argument_list; 133, string:"An error occurred while parsing {0}: {1}"; 134, identifier:format; 135, identifier:filename; 136, call; 137, identifier:str; 138, argument_list; 139, identifier:coe
code: def get_config_dir(path, pattern="*.config", configspec=None, allow_errors=False):
  	"""
  	Load an entire directory of configuration files, merging them into one.
  
  	This function will load multiple configuration files matching the given pattern,
  	in the given path, and merge them. The found files are first sorted alphabetically,
  	and then loaded and merged. A good practice is to use ConfigObj sections, for easy
  	loading of information like per-host configuration.
  
  	Parameters
  	----------
  	path: string
  		Absolute path to a directory of ConfigObj files
  	pattern: string
  		Globbing pattern used to find files. Defaults to *.config.
  	configspec: ConfigObj
  		Used to sanitize the values in the resulting ConfigObj. Validation errors are currently
  		not exposed to the caller.
  	allow_errors: boolean
  		If False, errors raised by ConfigObj are not caught.
  		If True, errors raise by ConfigObj are caught, and an error is logged using logger.
  	"""
  
  	logger = logging.getLogger(__name__)
  
  	logger.debug("Loading all files matching {0} in {1}".format(pattern, path))
  	files = Globber(path, include=[pattern], recursive=False).glob()
  	files = sorted(files)
  
  	config = ConfigObj()
  
  	for filename in files:
  		logger.debug("- Loading config for {0}".format(filename))
  		try:
  			conf = ConfigObj(filename, configspec=configspec)
  		except ConfigObjError, coe:
  			logger.error("An error occurred while parsing {0}: {1}".format(filename, str(coe)))
  			continue
  		if configspec:
  			conf.validate(Validator())
  		config.merge(conf)
  
  	return config