code: def prune_dict(val: Any, mode="strict"):
      """
      Given dict ``val``, returns new dict based on ``val`` with all empty elements removed.
  
      What constitutes "empty" is controlled by the ``mode`` parameter.  If mode is 'strict'
      then only ``None`` elements will be removed.  If mode is ``truthy``, then element ``x``
      will be removed if ``bool(x) is False``.
      """
  
      def is_empty(x):
          if mode == "strict":
              return x is None
          elif mode == "truthy":
              return bool(x) is False
          raise ValueError(
              "allowable values for `mode` include 'truthy' and 'strict'"
          )
  
      if isinstance(val, dict):
          new_dict = {}
          for k, v in val.items():
              if is_empty(v):
                  continue
              elif isinstance(v, (list, dict)):
                  new_val = prune_dict(v, mode=mode)
                  if not is_empty(new_val):
                      new_dict[k] = new_val
              else:
                  new_dict[k] = v
          return new_dict
      elif isinstance(val, list):
          new_list = []
          for v in val:
              if is_empty(v):
                  continue
              elif isinstance(v, (list, dict)):
                  new_val = prune_dict(v, mode=mode)
                  if not is_empty(new_val):
                      new_list.append(new_val)
              else:
                  new_list.append(v)
          return new_list
      else:
          return val
  
imports: from __future__ import annotations
  import copy
  import itertools
  import re
  import signal
  import warnings
  from datetime import datetime
  from functools import reduce
  from typing import TYPE_CHECKING, Any, Callable, Generator, Iterable, Mapping, MutableMapping, TypeVar, cast
  from lazy_object_proxy import Proxy
  from airflow.configuration import conf
  from airflow.exceptions import AirflowException, RemovedInAirflow3Warning
  from airflow.utils.module_loading import import_string
  from airflow.utils.types import NOTSET
label_desc: Use image node_id 24 for calling a global function with example usage: prune_dict(val, mode) and returns: new_dict, unknown, new_list, val, unknown