def METHOD_NAME(item):
    """
    Sanitize NaN values in a given item. The item can be a dict, list or float.
    """
    if isinstance(item, list):
        return [METHOD_NAME(sub_item) for sub_item in item]
    elif isinstance(item, dict):
        return {k: METHOD_NAME(v) for k, v in item.items()}
    elif isinstance(item, float) and math.isnan(item):
        return None
    else:
        return item