def read_config_file(f):
if isinstance(f, basestring):<EOL><INDENT>f = os.path.expanduser(f)<EOL><DEDENT>try:<EOL><INDENT>config = ConfigObj(f, interpolation=False, encoding='<STR_LIT:utf8>')<EOL><DEDENT>except ConfigObjError as e:<EOL><INDENT>log(LOGGER, logging.ERROR, "<STR_LIT>"<EOL>"<STR_LIT>".format(e.line_number, f))<EOL>log(LOGGER, logging.ERROR, "<STR_LIT>")<EOL>return e.config<EOL><DEDENT>except (IOError, OSError) as e:<EOL><INDENT>log(LOGGER, logging.WARNING, "<STR_LIT>"<EOL>"<STR_LIT>".format(e.filename))<EOL>return None<EOL><DEDENT>return config<EOL>
Read a config file.