def getRedisPool(params):
global RedisPools<EOL>global _defaultRedisConnectionParams<EOL>global _redisManagedConnectionParams<EOL>if not params:<EOL><INDENT>params = _defaultRedisConnectionParams<EOL>isDefaultParams = True<EOL><DEDENT>else:<EOL><INDENT>isDefaultParams = bool(params is _defaultRedisConnectionParams)<EOL><DEDENT>if '<STR_LIT>' in params:<EOL><INDENT>return params['<STR_LIT>']<EOL><DEDENT>hashValue = hashDictOneLevel(params)<EOL>if hashValue in RedisPools:<EOL><INDENT>params['<STR_LIT>'] = RedisPools[hashValue]<EOL>return RedisPools[hashValue]<EOL><DEDENT>if not isDefaultParams:<EOL><INDENT>origParams = params<EOL>params = copy.copy(params)<EOL><DEDENT>else:<EOL><INDENT>origParams = params<EOL><DEDENT>checkAgain = False<EOL>if '<STR_LIT:host>' not in params:<EOL><INDENT>if not isDefaultParams and '<STR_LIT:host>' in _defaultRedisConnectionParams:<EOL><INDENT>params['<STR_LIT:host>'] = _defaultRedisConnectionParams['<STR_LIT:host>']<EOL><DEDENT>else:<EOL><INDENT>params['<STR_LIT:host>'] = '<STR_LIT:127.0.0.1>'<EOL><DEDENT>checkAgain = True<EOL><DEDENT>if '<STR_LIT:port>' not in params:<EOL><INDENT>if not isDefaultParams and '<STR_LIT:port>' in _defaultRedisConnectionParams:<EOL><INDENT>params['<STR_LIT:port>'] = _defaultRedisConnectionParams['<STR_LIT:port>']<EOL><DEDENT>else:<EOL><INDENT>params['<STR_LIT:port>'] = <NUM_LIT><EOL><DEDENT>checkAgain = True<EOL><DEDENT>if '<STR_LIT>' not in params:<EOL><INDENT>if not isDefaultParams and '<STR_LIT>' in _defaultRedisConnectionParams:<EOL><INDENT>params['<STR_LIT>'] = _defaultRedisConnectionParams['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>params['<STR_LIT>'] = <NUM_LIT:0><EOL><DEDENT>checkAgain = True<EOL><DEDENT>if not isDefaultParams:<EOL><INDENT>otherGlobalKeys = set(_defaultRedisConnectionParams.keys()) - set(params.keys())<EOL>for otherKey in otherGlobalKeys:<EOL><INDENT>if otherKey == '<STR_LIT>':<EOL><INDENT>continue<EOL><DEDENT>params[otherKey] = _defaultRedisConnectionParams[otherKey]<EOL>checkAgain = True<EOL><DEDENT><DEDENT>if checkAgain:<EOL><INDENT>hashValue = hashDictOneLevel(params)<EOL>if hashValue in RedisPools:<EOL><INDENT>params['<STR_LIT>'] = RedisPools[hashValue]<EOL>return RedisPools[hashValue]<EOL><DEDENT><DEDENT>connectionPool = redis.ConnectionPool(**params)<EOL>origParams['<STR_LIT>'] = params['<STR_LIT>'] = connectionPool<EOL>RedisPools[hashValue] = connectionPool<EOL>origParamsHash = hashDictOneLevel(origParams)<EOL>if origParamsHash not in _redisManagedConnectionParams:<EOL><INDENT>_redisManagedConnectionParams[origParamsHash] = [origParams]<EOL><DEDENT>elif origParams not in _redisManagedConnectionParams[origParamsHash]:<EOL><INDENT>_redisManagedConnectionParams[origParamsHash].append(origParams)<EOL><DEDENT>return connectionPool<EOL>
getRedisPool - Returns and possibly also creates a Redis connection pool
        based on the REDIS_CONNECTION_PARAMS passed in.

        The goal of this method is to keep a small connection pool rolling
        to each unique Redis instance, otherwise during network issues etc
        python-redis will leak connections and in short-order can exhaust
        all the ports on a system. There's probably also some minor
        performance gain in sharing Pools.

        Will modify "params", if "host" and/or "port" are missing, will fill
        them in with defaults, and prior to return will set "connection_pool"
        on params, which will allow immediate return on the next call,
        and allow access to the pool directly from the model object.

        @param params <dict> - REDIS_CONNECTION_PARAMS - kwargs to redis.Redis

        @return redis.ConnectionPool corrosponding to this unique server.