pub fn get_required<T>(dict: &Bound<'_, PyDict>, key: &str) -> PyResult<T>where T: for<'py> FromPyObject<'py>,
Helper function to get a required value from a Python dictionary and extract it.
Returns the extracted value or a PyErr if the key is missing or extraction fails.
PyErr
Returns PyErr if the key is missing or value extraction fails.