code: def drop_warning_stat(
      idata: arviz.InferenceData,
  ) -> arviz.InferenceData:
      """Returns a new ``InferenceData`` object with the "warning" stat removed from sample stats groups.
  
      This function should be applied to an ``InferenceData`` object obtained with
      ``pm.sample(keep_warning_stat=True)`` before trying to ``.to_netcdf()`` or ``.to_zarr()`` it.
      """
      nidata = arviz.InferenceData(attrs=idata.attrs)
      for gname, group in idata.items():
          if "sample_stat" in gname:
              group = group.drop_vars(
                  names=["warning", "warning_dim_0"], errors="ignore"
              )
          nidata.add_groups(
              {gname: group}, coords=group.coords, dims=group.dims
          )
      return nidata
  
imports: import functools
  import warnings
  from typing import Any, Dict, List, NewType, Optional, Sequence, Tuple, Union, cast
  import arviz
  import cloudpickle
  import numpy
  import xarray
  from cachetools import LRUCache, cachedmethod
  from pytensor import Variable
  from pytensor.compile import SharedVariable
  from pytensor.graph.utils import ValidatingScratchpad
  from pymc.exceptions import BlockModelAccessError
label_desc: Use image node_id 10 for calling a global function with example usage: drop_warning_stat(idata) and returns: nidata