"Write a code snippet in [programming language] that accomplishes [specific task]. The code should be clear, well-commented, and optimized for efficiency. Consider including error handling and edge cases to ensure robustness. Aim to use best practices and follow coding conventions for [programming language]. Provide a brief explanation of the code's functionality and any important considerations. Your code should be easily understandable and reusable for other developers."
