def initialize(config):
<EOL>if '<STR_LIT>' in config:<EOL><INDENT>client = utils.find_entrypoint('<STR_LIT>',<EOL>config['<STR_LIT>'], required=True)<EOL><DEDENT>else:<EOL><INDENT>client = redis.StrictRedis<EOL><DEDENT>kwargs = {}<EOL>for cfg_var, type_ in REDIS_CONFIGS.items():<EOL><INDENT>if cfg_var in config:<EOL><INDENT>kwargs[cfg_var] = type_(config[cfg_var])<EOL><DEDENT><DEDENT>if '<STR_LIT:host>' not in kwargs and '<STR_LIT>' not in kwargs:<EOL><INDENT>raise redis.ConnectionError("<STR_LIT>")<EOL><DEDENT>cpool_class = None<EOL>cpool = {}<EOL>extra_kwargs = {}<EOL>for key, value in config.items():<EOL><INDENT>if key.startswith('<STR_LIT>'):<EOL><INDENT>_dummy, _sep, varname = key.partition('<STR_LIT:.>')<EOL>if varname == '<STR_LIT>':<EOL><INDENT>cpool[varname] = utils.find_entrypoint(<EOL>'<STR_LIT>', value, required=True)<EOL><DEDENT>elif varname == '<STR_LIT>':<EOL><INDENT>cpool[varname] = int(value)<EOL><DEDENT>elif varname == '<STR_LIT>':<EOL><INDENT>cpool[varname] = utils.find_entrypoint(<EOL>'<STR_LIT>', value, required=True)<EOL><DEDENT>else:<EOL><INDENT>cpool[varname] = value<EOL><DEDENT><DEDENT>elif key not in REDIS_CONFIGS and key not in REDIS_EXCLUDES:<EOL><INDENT>extra_kwargs[key] = value<EOL><DEDENT><DEDENT>if cpool:<EOL><INDENT>cpool_class = redis.ConnectionPool<EOL><DEDENT>if '<STR_LIT>' in config:<EOL><INDENT>cpool_class = utils.find_entrypoint('<STR_LIT>',<EOL>config['<STR_LIT>'],<EOL>required=True)<EOL><DEDENT>if cpool_class:<EOL><INDENT>cpool.update(kwargs)<EOL>if '<STR_LIT>' not in cpool:<EOL><INDENT>if '<STR_LIT>' in cpool:<EOL><INDENT>if '<STR_LIT:host>' in cpool:<EOL><INDENT>del cpool['<STR_LIT:host>']<EOL><DEDENT>if '<STR_LIT:port>' in cpool:<EOL><INDENT>del cpool['<STR_LIT:port>']<EOL><DEDENT>cpool['<STR_LIT:path>'] = cpool['<STR_LIT>']<EOL>del cpool['<STR_LIT>']<EOL>cpool['<STR_LIT>'] = redis.UnixDomainSocketConnection<EOL><DEDENT>else:<EOL><INDENT>cpool['<STR_LIT>'] = redis.Connection<EOL><DEDENT><DEDENT>kwargs = dict(connection_pool=cpool_class(**cpool))<EOL><DEDENT>kwargs.update(extra_kwargs)<EOL>return client(**kwargs)<EOL>
Initialize a connection to the Redis database.