code: def convert_bool(value: bool | str) -> bool:
      """Convert a string to True or False.
  
      If a boolean is passed in, it is returned as-is. Otherwise the function
      maps the following strings, ignoring case:
  
      * "yes", "1", "on" -> True
      * "no", "0", "off" -> False
  
      Args:
          value (str):
              A string value to convert to bool
  
      Returns:
          bool
  
      Raises:
          ValueError
  
      """
      if isinstance(value, bool):
          return value
  
      val = value.lower()
      if val in ["yes", "1", "on", "true", "True"]:
          return True
      if val in ["no", "0", "off", "false", "False"]:
          return False
  
      raise ValueError(f"Cannot convert {value} to boolean value")
  
imports: from __future__ import annotations
  import logging
  import os
  from os.path import join
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, Callable, Generic, Literal, Sequence, TypeVar, Union, cast
  import yaml
  from .util.deprecation import deprecated
  from .util.paths import bokehjs_path, server_path
label_desc: Use image node_id 3 for calling a global function with example usage: convert_bool(value) and returns: value, True, False