Parse comma-separated list
A rollout script needs the target machines from a config file. Lines look like "key=value" after trimming; ignore blank lines, "#" comment lines, and lines lacking "=". The key is the text before the first "=" with surrounding spaces removed; if the file assigns the requested key several times, only the FINAL assignment counts. Its value is a comma-separated list: split on every comma, trim each piece, and throw away pieces that are empty after trimming. Return the pieces in the order written. If the key never appears, return an empty list.
expand_host_list(lines: list[str], key: str) → list[str][["hosts=a.example, b.example ,c.example"],"hosts"]out["a.example","b.example","c.example"]State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
[["hosts=a.example, b.example ,c.example"],"hosts"]["a.example","b.example","c.example"]not run yetsample