Unflatten dotted paths

Write codeMedium16 min

Your task

Turn flat dotted settings back into an indented outline for a settings editor. Input lines have the exact shape "dotted.path=value" (split at the first "="; a repeated path keeps its final value). Path segments use lowercase letters, digits, and underscores; no path is also a parent of another. Emit the outline as a list of strings: intermediate segments appear as "name:" and each final segment as "name: value", indented 2 spaces per nesting level. Siblings at every level are ordered alphabetically, and a parent line is printed once before its children. Example: ["app.port=8080"] gives ["app:", " port: 8080"].

Examples

render_config_tree(lines: list[str]) -> list[str]
Example 1
Inputrender_config_tree(["app.name=api", "app.port=8080", "debug=false"])
Output["app:", " name: api", " port: 8080", "debug: false"]