docs: def init_validator(required, cls, *additional_validators):
      """
      Create an attrs validator based on the cls provided and required setting.
      :param bool required: whether the field is required in a given model.
      :param cls: the expected class type of object value.
      :return: attrs validator chained correctly (e.g. optional(instance_of))
      """
      validator = validators.instance_of(cls)
  
      if additional_validators:
          additional_validators = list(additional_validators)
          additional_validators.append(validator)
          validator = composite(*additional_validators)
  
      return validator if required else validators.optional(validator)