code: def get_connection(self, is_read_only=False) -> redis.StrictRedis:
          
          if self.connection is not None:
              return self.connection
  
          if self.is_sentinel:
              kwargs = dict()
              if self.password:
                  kwargs["password"] = self.password
              sentinel = Sentinel([(self.host, self.port)], **kwargs)
              if is_read_only:
                  connection = sentinel.slave_for(self.sentinel_service, decode_responses=True)
              else:
                  connection = sentinel.master_for(self.sentinel_service, decode_responses=True)
          else:
              connection = redis.StrictRedis(host=self.host, port=self.port, decode_responses=True,
                                             password=self.password)
          self.connection = connection
          return connection
docs: Gets a StrictRedis connection for normal redis or for redis sentinel based upon redis mode in configuration.
  
          :type is_read_only: bool
          :param is_read_only: In case of redis sentinel, it returns connection to slave
  
          :return: Returns a StrictRedis connection