docs: def get_config(config_base, custom_file=None, configspec=None):
  	"""
  	Loads a configuration file from multiple locations, and merge the results into one.
  
  	This function will load configuration files from a number of locations in sequence,
  	and will overwrite values in the previous level if they are redefined in the current.
  
  	The levels are in sequence:
  
  	1. Distribution level configuration in the program directory called $config_base.config.
  	2. System-wide level configuration in /etc/$config_base.config
  	3. User level configuration in ~/.$config_base.config
  	4. An optionally specified $custom_file
  
  	Parameters
  	----------
  	config_base: string
  		Basename of the configuration file, typically the same as the name of the program.
  	custom_file: string
  		Absolute path to a custom configuration file.
  	configspec: ConfigObj
  		Used to sanitize the values in the resulting ConfigObj. Validation errors are currently
  		not exposed to the caller.
  	"""
  
  	logger = logging.getLogger(__name__)
  
  	logger.debug("Expanding variables")
  	home = os.path.expanduser("~")
  	loc = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
  
  	logger.debug("Create empty config")
  	config = ConfigObj()
  
  	# Merge in config file in program dir
  	if os.path.isfile(os.path.join(loc, "%s.config" % config_base)):
  		logger.debug("Loading config from workingdir")
  		cfg = ConfigObj(os.path.join(loc, "%s.config" % config_base), configspec=configspec)
  		if configspec:
  			cfg.validate(Validator())
  		config.merge(cfg)
  
  	# Merge in system-wide config (Unix specific)
  	if os.path.isfile("/etc/%s.config" % config_base):
  		logger.debug("Loading config from /etc")
  		cfg = ConfigObj("/etc/%s.config" % config_base, configspec=configspec)
  		if configspec:
  			cfg.validate(Validator())
  		config.merge(cfg)
  
  	# Merge in user specific config
  	if os.path.isfile(os.path.join(home, ".%s.config" % config_base)):
  		logger.debug("Loading config from homedir")
  		cfg = ConfigObj(os.path.join(home, ".%s.config" % config_base), configspec=configspec)
  		if configspec:
  			cfg.validate(Validator())
  		config.merge(cfg)
  
  	# Config file provided on command line has preference
  	if custom_file:
  		logger.debug("Loading custom config file")
  		cfg = ConfigObj(custom_file, configspec=configspec)
  		if configspec:
  			cfg.validate(Validator())
  		config.merge(cfg)
  
  	return config