pub(crate) fn validate_class( expected: &Bound<'_, PyType>, value: &Bound<'_, PyAny>, ) -> PyResult<()>