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