Implement only the missing function below.

Rules:
- Do not change existing public method signatures
- Do not rewrite the full file
- Generate only the new or modified code
- Keep the solution readable
- Add error handling where required

Code:
<paste relevant function/class only>

---

**Recommended model:** Claude Sonnet 4.6 Medium / GPT 5.4 mini Medium
