def get_an_int(errmsg, arg, msg_on_error, min_value=None, max_value=None):
    """Another get_int() routine, this one simpler and less stylized
    than get_int(). We eval arg return it as an integer value or
    None if there was an error in parsing this.
    """
    ret_value = None
    if arg:
        try:
            ret_value = int(eval(arg))
        except (SyntaxError, NameError, ValueError):
            if errmsg:
                errmsg(msg_on_error)
            else:
                errmsg('Expecting an integer, got: %s.' % str(arg))
            return None
    if min_value and ret_value < min_value:
        errmsg('Expecting integer value to be at least %d, got: %d.' % (
            min_value, ret_value))
        return None
    elif max_value and ret_value > max_value:
        errmsg('Expecting integer value to be at most %d, got: %d.' % (
            max_value, ret_value))
        return None
    return ret_value
