code: def bool_from_any(x: Any) -> bool:
      """Converts bool/float/int/str to bool or raises error."""
      if isinstance(x, bool):
          return x
      elif isinstance(x, (float, int)):
          return x == 1.0
      elif isinstance(x, str):
          if x.isnumeric():
              return float(x) == 1.0
          elif x.strip().lower() == "true":
              return True
          elif x.strip().lower() == "false":
              return False
          else:
              raise ValueError("Cannot convert string to bool")
      else:
          raise TypeError("Cannot convert to bool")
  
imports: import logging
  from abc import ABC, abstractmethod
  from typing import Any, Dict, List, Optional, Text, Type
  import rasa.shared.core.constants
  from rasa.shared.exceptions import RasaException
  import rasa.shared.utils.common
  import rasa.shared.utils.io
  from rasa.shared.constants import DOCS_URL_SLOTS
label_desc: Use image node_id 1 for calling a global function with example usage: bool_from_any(x) and returns: x, unknown, unknown, True, False