code: def sample_stats_to_xarray(self):
          
          data = self.sample_stats
          if not isinstance(data, dict):
              raise TypeError("DictConverter.sample_stats is not a dictionary")
  
          return dict_to_dataset(data, library=None, coords=self.coords, dims=self.dims)
docs: Convert sample_stats samples to xarray.