Task: Implement the Python module tree_stages_optional with a function that matches the tests.
What to implement and where:
Create a Python module at /app/tree_stages_optional.py (alternatively, a package at /app/tree_stages_optional/ with an init.py exporting declare_temp_wires).
Provide a function with the exact signature:
def declare_temp_wires(n: int) -> str
Required behavior and contract:
Type validation
If n is not an int, raise a TypeError with the exact message:
declare_temp_wires: only integers are accepted.
Value validation
If n < 2, raise a ValueError with the exact message:
declare_temp_wires: cannot be less than 2.
Successful generation (n >= 2)
Return a string that exactly matches the formatting used in tests:
'\t// Declaring temporary wires\n\ttemp[{}:0];'.format(n - 1)
Example: for n = 2, return '\t// Declaring temporary wires\n\ttemp[1:0];'
Notes:
The string must include a leading tab on both lines and use a newline between lines, with no extra trailing whitespace.
Do not print anything; only return the string.
The tests import the function as: from tree_stages_optional import declare_temp_wires, so ensure the module/package is importable from the project root (i.e., /app is on the Python path during tests).