code: def strtobool(val: str) -> bool:
      """
      A port of the distutils.util.strtobool function, removed in python 3.12.
  
      The only difference in this function is that any non-falsy value which is a non-empty string is
      accepted as a true value.  That small difference gives us a small headstart on this todo:
  
      TODO(MLG-1520): we should instead treat any nonempty string as "true".
      """
      return bool(
          val
          and val.lower() not in ("n", "no", "f", "false", "off", "0")
      )
  
imports: import datetime
  import functools
  import io
  import json
  import os
  import pathlib
  import platform
  import random
  import re
  import sys
  import time
  import warnings
  from typing import IO, Any, Callable, Dict, Iterator, Optional, Sequence, Tuple, TypeVar, Union, cast, no_type_check, overload
  import urllib3
  from determined.common import yaml
label_desc: Use image node_id 21 for calling a global function with example usage: strtobool(val) and returns: bool