pub fn to_py_object<T>(py: Python<'_>, value: &T) -> PyResult<PyObject>where T: Serialize,
Serialize into Python object.