def delete_empty_fields(d: dict) -> dict:
    """
    Deletes the None fields in a dictionary recursively
    Mostly used to make resulting JSON dumps lighter

    Args:
        d: The dictionary to reduce

    Returns:
        The reduced dictionary

    """
    for key, value in list(d.items()):
        if isinstance(value, dict):
            delete_empty_fields(value)
        elif value is None:
            d.pop(key)
        elif isinstance(value, list):
            for list_value in value:
                if isinstance(list_value, dict):
                    delete_empty_fields(list_value)

    return d