def validate_number_attribute(tag, attribute_name, attribute_value):
    """Validates whether the given attribute value is an integer or float
    value.
    """
    if not attribute_value:
        return
    if isinstance(attribute_value, (int, float)):
        return attribute_value
    elif isinstance(attribute_value, str):
        try:
            return int(attribute_value)
        except ValueError:
            try:
                return float(attribute_value)
            except ValueError:
                raise AttributeError(
                    '<{tag}>: {attribute} attribute should be an integer or float value'
                    .format(tag=tag, attribute=attribute_name))
    else:
        raise AttributeError(
            '<{tag}>: {attribute} attribute should be an integer or float value'
            .format(tag=tag, attribute=attribute_name))
