code: def str_to_bool(val):
      
      if isinstance(val, str):
          val = val.lower()
  
      return val in ["true", "on", "yes", True]
docs: Helper function to turn a string representation of "true" into
      boolean True.