class_docstr: Validator that can be switched on/off according to
  a filter. (This wraps around another validator.)
class_docstr_tok: ["Validator","that","can","be","switched","on\/off","according","to","a","filter",".","(","This","wraps","around","another","validator",".",")"]
code: def __init__(
      self, validator: Validator, filter: FilterOrBool
  ) -> None:
      self.validator = validator
      self.filter = to_filter(filter)
  
imports: from __future__ import annotations
  from abc import ABCMeta, abstractmethod
  from typing import Callable
  from prompt_toolkit.eventloop import run_in_executor_with_context
  from .document import Document
  from .filters import FilterOrBool, to_filter
label_desc: Use image node_id 1 to create a new ConditionalValidator object from inherited base classes: Validator with example: obj = ConditionalValidator(validator, filter)