pub fn extract_shape(shape_obj: &Bound<'_, PyAny>) -> PyResult<Vec<usize>>
Convert Python objects to shape vector