pub fn handle_py_value_err<T: Into<P>, E: ToString, P>(
    res: Result<T, E>
) -> PyResult<P>