Python Function Input Validation Vulnerability