code: def set_option(name: str, val: Any):
      """Set the value of option.
  
      Parameters
      ----------
      name : str
          The name of the option.
      val : Any
          The value to set.
  
      Raises
      ------
      KeyError
          If option ``name`` does not exist.
      BaseException
          Raised by validator if the value is invalid.
      """
      try:
          option = _OPTIONS[name]
      except KeyError:
          raise KeyError(f'"{name}" does not exist.')
      option.validator(val)
      option.value = val
  
imports: import os
  import textwrap
  from collections.abc import Container
  from contextlib import ContextDecorator
  from dataclasses import dataclass
  from typing import Any, Callable, Dict, Optional
label_desc: Use image node_id 5 for calling a global function with example usage: set_option(name, val) without return types