code: def optional(validator):
      """
      A validator that makes an attribute optional.  An optional attribute is one
      which can be set to ``None`` in addition to satisfying the requirements of
      the sub-validator.
  
      :param Callable | tuple[Callable] | list[Callable] validator: A validator
          (or validators) that is used for non-``None`` values.
  
      .. versionadded:: 15.1.0
      .. versionchanged:: 17.1.0 *validator* can be a list of validators.
      .. versionchanged:: 23.1.0 *validator* can also be a tuple of validators.
      """
      if isinstance(validator, (list, tuple)):
          return _OptionalValidator(_AndValidator(validator))
  
      return _OptionalValidator(validator)
  
imports: import operator
  import re
  from contextlib import contextmanager
  from re import Pattern
  from ._config import get_run_validators, set_run_validators
  from ._make import _AndValidator, and_, attrib, attrs
  from .converters import default_if_none
  from .exceptions import NotCallableError
label_desc: Use image node_id 7 for calling a global function with example usage: optional(validator) and returns: _OptionalValidator, _OptionalValidator