def METHOD_NAME(library_interpreter, code, ignore_warnings, is_error_handling):
    '''handle_error
    Helper function for handling errors returned by nidmm.Library.
    It calls back into the LibraryInterpreter to get the corresponding error
    description and raises if necessary.
    '''
    if _is_success(code) or (_is_warning(code) and ignore_warnings):
        return
    if is_error_handling:
        # The caller is in the midst of error handling and an error occurred.
        # Don't try to get the description or we'll start recursing until the stack overflows.
        description = ''
    else:
        description = library_interpreter.get_error_description(code)
    if _is_error(code):
        raise DriverError(code, description)
    assert _is_warning(code)
    warnings.warn(DriverWarning(code, description))