code: def anything2bool(val):
      if hasattr(val, "lower"):
          val = val.lower()
      if val in {"off", "no", "false", "0"} or not bool(val):
          return False
      elif (
          val in {"on", "yes", "true", True}
          or (hasattr(val, "isdigit") and val.isdigit() and int(val))
          or isinstance(val, int)
          and val
      ):
          return True
      else:
          raise TypeError(
              "Got value %s which could not be interpreted as a boolean"
              % repr(val)
          )
  
imports: import json
  import logging
  import os
  import re
  import threading
  import warnings
  from collections import namedtuple
  from fasteners import InterProcessLock
  from functools import lru_cache, wraps
  from pathlib import Path
  import datalad
  from datalad.consts import DATASET_CONFIG_FILE
  from datalad.runner import CommandError, GitRunner, KillOutput, StdOutErrCapture
  from datalad.utils import getpwd, on_windows
label_desc: Use image node_id 7 for calling a global function with example usage: anything2bool(val) and returns: False, True