pub(crate) fn error_on_negative_with_result<T: From<i8> + Ord>( py: Python<'_>, result: T, ) -> PyResult<T>
Returns Ok wrapping the result if the error code is non-negative.