#NEWLINE# def get_redis_connection( uri = None ) : #NEWLINE# #INDENT# uri = ( uri or BII_ANALYTIC_REDIS_URL ) #NEWLINE# global redis_connection #NEWLINE# if redis_connection : #NEWLINE# #INDENT# return redis_connection #NEWLINE# #UNINDENT# result = urlparse ( uri ) #NEWLINE# redis_pool = redis . ConnectionPool ( host = result . hostname , max_connections = 1 , port = result . port , db = result . path [ 1 : ] , password = result . password ) #NEWLINE# connection = redis . Redis ( connection_pool = redis_pool ) #NEWLINE# return connection