pub fn with_pycallbacks<T, F>(func: F) -> PyResult<T>where F: FnMut(Python<'_>, &PyAny) -> PyResult<T>,