def check_int_arg_is_in_range(value, name, gte_value, lte_value=None):
    """
    Check that variable with name 'name' >= gte_value and optionally <= lte_value
    :param value: variable value
    :param name: variable name
    :param errors: list of error tuples (error_id, value)
    :param gte_value: greater than or equal to value
    :param lte_value: less than or equal to value
    :return: boolean (1=true, 0=false)
    """

    if not isinstance(value, int):
        try:
            raise InvenioWebCommentError('%s is not a number.' % value)
        except InvenioWebCommentError as exc:
            register_exception()
            body = webcomment_templates.tmpl_error(exc.message)
            return body
        #errors.append(('ERR_WEBCOMMENT_ARGUMENT_NAN', value))
        return 0

    if value < gte_value:
        try:
            raise InvenioWebCommentError('%s invalid argument.' % value)
        except InvenioWebCommentError as exc:
            register_exception()
            body = webcomment_templates.tmpl_error(exc.message)
            return body
        #errors.append(('ERR_WEBCOMMENT_ARGUMENT_INVALID', value))
        return 0
    if lte_value:
        if value > lte_value:
            try:
                raise InvenioWebCommentError('%s invalid argument.' % value)
            except InvenioWebCommentError as exc:
                register_exception()
                body = webcomment_templates.tmpl_error(exc.message)
                return body
            #errors.append(('ERR_WEBCOMMENT_ARGUMENT_INVALID', value))
            return 0
    return 1