code: def _convert_arviz_dict_to_pyjags_dict(
      samples: tp.Mapping[str, np.ndarray]
  ) -> tp.Mapping[str, np.ndarray]:
      """
      Convert and ArviZ dictionary to a PyJAGS dictionary.
  
      Takes a python dictionary of samples in ArviZ format and returns the samples
      as a dictionary in PyJAGS format.
  
      Parameters
      ----------
      samples: dict of {str : array_like}
          a dictionary mapping variable names to NumPy arrays with shape
          (number_of_chains, chain_length, parameter_dimension)
  
      Returns
      -------
      a dictionary mapping variable names to NumPy arrays with shape
               (parameter_dimension, chain_length, number_of_chains)
  
      """
      # pyjags returns a dictionary of NumPy arrays with shape
      #         (parameter_dimension, chain_length, number_of_chains)
      # but arviz expects samples with shape
      #         (number_of_chains, chain_length, parameter_dimension)
  
      variable_name_to_samples_map = {}
  
      for variable_name, chains in samples.items():
          if chains.ndim == 2:
              number_of_chains, chain_length = chains.shape
              chains = chains.reshape(
                  (number_of_chains, chain_length, 1)
              )
  
          variable_name_to_samples_map[variable_name] = np.swapaxes(
              chains, 0, 2
          )
  
      return variable_name_to_samples_map
  
imports: import typing
  from collections import OrderedDict
  from collections.abc import Iterable
  import numpy
  import xarray
  from .inference_data import InferenceData
  from ..rcparams import rcParams
  from .base import dict_to_dataset
label_desc: Use image node_id 5 for calling a global function with example usage: _convert_arviz_dict_to_pyjags_dict(samples) and returns: variable_name_to_samples_map