code: def read_config(section, variables, sink, filename = None, logvars = False):
      
      global _ETC_PATHS
      import ConfigParser
      config = ConfigParser.ConfigParser()
      
      if filename is None:
          config_files = existing_config_files()
      else:
          config_files = []
          for fpath in _ETC_PATHS:
              config_files.append("%s/%s" % (fpath, filename))
      
      config.read(config_files)
  
      options = {}
      if section in config.sections():
          options = config.options(section)
  
      for varname, value in variables.items():
          orig_varname = varname
          varname = varname.lower()
          if varname in options:
              try:
                  if isinstance(value, bool):
                      value = config.getboolean(section, varname)
                  elif isinstance(value, int):
                      value = config.getint(section, varname)
                  elif isinstance(value, float):
                      value = config.getfloat(section, varname)
                  else:
                      value = config.get(section, varname)
                      if len(value) > 0:
                          value = value.split("#")[0].strip()
              except:
                  raise Exception("Invalid value for variable %s in config file" % orig_varname)
                  
          varname = varname.upper()
          sink.__dict__[varname] = value
          if (logvars):
              _LOGGER.debug("%s=%s" % (varname, str(value)))
docs: This functions creates a dictionary whose keys are the variables indicated in
          'variables' with the values obtained from the config filenames set for this module.
          
          'variables' is a dictionary of variable names and default values { 'VAR1': defaultval1, ...}
          
          The value for the variables is searched under the 'section' section from the configuration
          files (all the configuration files: the main one and those included by the config_filter
          mechanism)
          
          Sink is a dictionary (or object) that admits each of the variables to be created and set
          the value.