def METHOD_NAME(config: settings.RedisClusterConfig) -> RedisClientType:
    if config["use_redis_cluster"]:
        startup_nodes = config["cluster_startup_nodes"]
        if startup_nodes is None:
            startup_nodes = [{"host": config["host"], "port": config["port"]}]
        startup_cluster_nodes = [
            ClusterNode(n["host"], n["port"]) for n in startup_nodes
        ]
        return RetryingRedisCluster(
            startup_nodes=startup_cluster_nodes,
            socket_keepalive=True,
            password=config["password"],
            max_connections_per_node=True,
            reinitialize_steps=config["reinitialize_steps"],
        )
    else:
        return SingleNodeRedis(
            host=config["host"],
            port=config["port"],
            password=config["password"],
            db=config["db"],
            ssl=config.get("ssl", False),
            socket_keepalive=True,
        )