def debug_validator(validator: ValidatorType) -> ValidatorType:
    """
    Use as a wrapper around a validator, e.g.

    .. code-block:: python

        self.validator = debug_validator(OneOf(["some", "values"]))

    If you do this, the log will show the thinking of the validator (what it's
    trying to validate, and whether it accepted or rejected the value).
    """
    def _validate(node: SchemaNode, value: Any) -> None:
        log.debug("Validating: {!r}", value)
        try:
            validator(node, value)
            log.debug("... accepted")
        except Invalid:
            log.debug("... rejected")
            raise

    return _validate