code: def str_to_bool(val):
      
      val = str(val).lower().strip()
      if val in ("1", "true", "on", "yes"):
          return True
      elif val in ("0", "false", "off", "no"):
          return False
      raise ValueError(
          "Invalid value '{}'"
          "(expected '1', '0', 'true', 'false', 'on', 'off', 'yes', 'no').".format(val)
      )
docs: Return a boolean for '0', 'false', 'on', ...