_sanitize_dict

_sanitize_dict(d: dict[str, Any] | Any) dict[str, Any] | Any[source]

Sanitize an input dictionary and produce a new sanitized dictionary.

Recursively sanitize a dictionary by removing keys with values that are None, empty lists, or empty dictionaries.

Parameters:

d (dict[str, Any] | Any) – The dictionary to sanitize or any other value.

Returns:

The sanitized dict or the original value if input is not a dict.

Return type:

dict[str, Any] | Any