Creates a validator that checks if the given numeric value is in the
    specified range, inclusive.

    Accepts values specified by ``numbers.Number`` only, excluding booleans.

    The error messages raised can be customized with ``min_message`` and
    ``max_message``. The ``min`` and ``max`` arguments are formatted.

def Range(min=None, max=None, min_message="Must be at least {min}", max_message="Must be at most {max}"):
    """
    Creates a validator that checks if the given numeric value is in the
    specified range, inclusive.

    Accepts values specified by ``numbers.Number`` only, excluding booleans.

    The error messages raised can be customized with ``min_message`` and
    ``max_message``. The ``min`` and ``max`` arguments are formatted.
    """
    @wraps(Range)
    def built(value):
        if not isinstance(value, numbers.Number) or isinstance(value, bool):
            raise Error("Not a number")
        if min is not None and min > value:
            raise Error(min_message.format(min=min, max=max))
        if max is not None and value > max:
            raise Error(max_message.format(min=min, max=max))
        return value
    return built