parameters: (varname: str, default: bool)
docstring: Read an environment variable and interpret it as a boolean.
      True: 'y', 'yes', 't', 'true', 'on', and '1';
      False: 'n', 'no', 'f', 'false', 'off', and '0'.
  
      Args:
          varname: the name of the variable
          default: the default boolean value
docstring_summary: Read an environment variable and interpret it as a boolean.
      True: 'y', 'yes', 't', 'true', 'on', and '1';
      False: 'n', 'no', 'f', 'false', 'off', and '0'.
docstring_tokens: Read an environment variable and interpret it as a boolean . True : y yes t true on and 1 ; False : n no f false off and 0 .
function: def bool_env(varname: str, default: bool) -> bool:
      """Read an environment variable and interpret it as a boolean.
      True: 'y', 'yes', 't', 'true', 'on', and '1';
      False: 'n', 'no', 'f', 'false', 'off', and '0'.
  
      Args:
          varname: the name of the variable
          default: the default boolean value
      """
      val = os.getenv(varname, str(default))
      val = val.lower()
      if val in ("y", "yes", "t", "true", "on", "1"):
          return True
      elif val in ("n", "no", "f", "false", "off", "0"):
          return False
      else:
          raise ValueError("invalid truth value %r for environment %r" % (val, varname))
function_tokens: def bool_env ( varname : str , default : bool ) -> bool : val = os . getenv ( varname , str ( default ) ) val = val . lower ( ) if val in ( "y" , "yes" , "t" , "true" , "on" , "1" ) : return True elif val in ( "n" , "no" , "f" , "false" , "off" , "0" ) : return False else : raise ValueError ( "invalid truth value %r for environment %r" % ( val , varname ) )