def METHOD_NAME(
    param: str,
    topic_spec: Optional[KafkaTopicSpec],
    cli_param: Optional[str],
    slice_id: Optional[int],
) -> Optional[TopicConfig]:
    if topic_spec is None:
        if cli_param is not None:
            raise ValueError(f"{param} not supported for this storage")
        return None
    assert topic_spec is not None
    if cli_param is not None:
        physical_topic_name = cli_param
    else:
        physical_topic_name = topic_spec.get_physical_topic_name(slice_id)
    broker = _get_default_topic_configuration(topic_spec.topic, slice_id)
    logical_topic_name = topic_spec.topic.value
    return TopicConfig(
        broker_config=broker,
        logical_topic_name=logical_topic_name,
        physical_topic_name=physical_topic_name,
    )