Exit if `ret` is not OK (a negative number).

def ok(no_exit, func, *args, **kwargs):
    """Exit if `ret` is not OK (a negative number)."""
    ret = func(*args, **kwargs)
    if no_exit or ret >= 0:
        return ret
    reason = errmsg[abs(ret)]
    error('{0}() returned {1} ({2})'.format(func.__name__, ret, reason))