class_docstr: Encapsulate CmdStanPy specific logic.
docstr: Extract sample_stats from fit.
code: def sample_stats_to_xarray_pre_v_1_0_0(self, fit):
      """Extract sample_stats from fit."""
      dtypes = {
          "divergent__": bool,
          "n_leapfrog__": np.int64,
          "treedepth__": np.int64,
          **self.dtypes,
      }
      if hasattr(fit, "metadata"):
          items = list(
              fit.metadata._method_vars_cols.keys()
          )  # pylint: disable=protected-access
      else:
          items = list(fit.sampler_vars_cols.keys())
      rename_dict = {
          "divergent": "diverging",
          "n_leapfrog": "n_steps",
          "treedepth": "tree_depth",
          "stepsize": "step_size",
          "accept_stat": "acceptance_rate",
      }
  
      data, data_warmup = _unpack_fit_pre_v_1_0_0(
          fit,
          items,
          self.save_warmup,
          self.dtypes,
      )
      for item in items:
          name = re.sub("__$", "", item)
          name = rename_dict.get(name, name)
          data[name] = data.pop(item).astype(dtypes.get(item, float))
          if data_warmup:
              data_warmup[name] = data_warmup.pop(item).astype(
                  dtypes.get(item, float)
              )
      return (
          dict_to_dataset(
              data,
              library=self.cmdstanpy,
              coords=self.coords,
              dims=self.dims,
              index_origin=self.index_origin,
          ),
          dict_to_dataset(
              data_warmup,
              library=self.cmdstanpy,
              coords=self.coords,
              dims=self.dims,
              index_origin=self.index_origin,
          ),
      )
  
imports: import logging
  import re
  from collections import defaultdict
  from copy import deepcopy
  from pathlib import Path
  import numpy
  from ..rcparams import rcParams
  from .base import dict_to_dataset, infer_stan_dtypes, make_attrs, requires
  from .inference_data import InferenceData
label_desc: Use image node_id 20 for calling the CmdStanPyConverter obj's underlying member method code with example usage: obj.sample_stats_to_xarray_pre_v_1_0_0(fit) and returns: dict_to_dataset,  dict_to_dataset