code: def cast_str_to_bool(value, strip=True):
      # type: (Any, bool) -> Optional[bool]
      a_strip_v = value if not strip else str(value).lower().strip()
      if a_strip_v == "false" or not a_strip_v:
          return False
      elif a_strip_v == "true":
          return True
      else:
          # first try to cast to integer
          try:
              return bool(int(a_strip_v))
          except (ValueError, TypeError):
              return None
  
imports: from typing import Optional, Any
label_desc: Use image node_id 4 for calling a global function with example usage: cast_str_to_bool(value, strip) and returns: False, True, bool, None