Python validation for structured data