code: def read_config_file(f):
      
  
      if isinstance(f, basestring):
          f = os.path.expanduser(f)
  
      try:
          config = ConfigObj(f, interpolation=False, encoding='utf8')
      except ConfigObjError as e:
          log(LOGGER, logging.ERROR, "Unable to parse line {0} of config file "
              "'{1}'.".format(e.line_number, f))
          log(LOGGER, logging.ERROR, "Using successfully parsed config values.")
          return e.config
      except (IOError, OSError) as e:
          log(LOGGER, logging.WARNING, "You don't have permission to read "
              "config file '{0}'.".format(e.filename))
          return None
  
      return config
docs: Read a config file.