def METHOD_NAME(value, name):
    """Checks that value is either unspecified, or a valid interval bound.
    Otherwise raises InvalidArgument.
    """
    if value is None or isinstance(value, (int, Rational)):
        return
    if not isinstance(value, (Real, decimal.Decimal)):
        raise InvalidArgument(f"{name}={value!r} must be a real number.")
    if math.isnan(value):
        raise InvalidArgument(f"Invalid end point {name}={value!r}")