def validate(instance, attrib, new_value):
    """
    Run *attrib*'s validator on *new_value* if it has one.

    .. versionadded:: 20.1.0
    """
    if _config._run_validators is False:
        return new_value

    v = attrib.validator
    if not v:
        return new_value

    v(instance, attrib, new_value)

    return new_value

    Run *attrib*'s validator on *new_value* if it has one.

    .. versionadded:: 20.1.0
    
product/gradle-plugin/src/main/python/attr/setters.py