code: def __get_connection(self) -> redis.Redis:
          
  
          if self.__redis_use_socket:
              r = redis.from_url(
                  'unix://{:s}?db={:d}'.format(
                      self.__redis_host,
                      self.__redis_db
                  )
              )
          else:
              r = redis.from_url(
                  'redis://{:s}:{:d}/{:d}'.format(
                      self.__redis_host,
                      self.__redis_port,
                      self.__redis_db
                  )
              )
  
          if BlackRed.Settings.REDIS_AUTH is not None:
              r.execute_command('AUTH {:s}'.format(BlackRed.Settings.REDIS_AUTH))
          return r
docs: Get a Redis connection
  
          :return: Redis connection instance
          :rtype: redis.Redis