<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_connection(self):
 """Return a valid redis connection based on the following settings * `REDIS_CONNECTIONS` * `EVENTLIB_REDIS_CONFIG_NAME` The first one is a dictionary in the following format: The second one is the name of the entry present in the above dict, like `server1` or `server2`. """


        if self.conn:
            return self.conn

        redis_configs = getsetting('REDIS_CONNECTIONS')
        if redis_configs:
            config_name = getsetting('EVENTLIB_REDIS_CONFIG_NAME', 'default')
            config = redis_configs[config_name]
            host = config['HOST']
            port = config['PORT']
            self.conn = redis.StrictRedis(host=host, port=port)
        else:
            self.conn = None
        return self.conn