code: def cast_bool(
      *args: CastType, value: Optional[CastType] = None
  ) -> Any:
      value = _normalize_cast_value(*args, value=value)
      if isinstance(value, QuotedString):
          return cast_bool(value.text)
      if isinstance(value, dict):
          return apply_to_dict_values(value, cast_bool)
      if isinstance(value, list):
          return list(map(cast_bool, value))
      elif isinstance(value, ChoiceSweep):
          return cast_choice(value, cast_bool)
      elif isinstance(value, RangeSweep):
          return cast_range(value, cast_bool)
      elif isinstance(value, IntervalSweep):
          raise ValueError("Intervals cannot be cast to bool")
  
      if isinstance(value, str):
          if value.lower() == "false":
              return False
          elif value.lower() == "true":
              return True
          else:
              raise ValueError(f"Cannot cast '{value}' to bool")
      return bool(value)
  
imports: import builtins
  import random
  from copy import copy
  from typing import Any, Callable, Dict, List, Optional, Union
  from hydra._internal.grammar.utils import is_type_matching
  from hydra.core.override_parser.types import ChoiceSweep, Glob, IntervalSweep, ParsedElementType, QuotedString, RangeSweep, Sweep
label_desc: Use image node_id 10 for calling a global function with example usage: cast_bool() and returns: bool, cast_bool, apply_to_dict_values, list, cast_choice, False, cast_range, True