def get_arviz_plot_dict(mod,
                        incl_noise_params=False,
                        incl_trend_params=False,
                        incl_smooth_params=False):
    """ This is a utility to prepare the plotting dictionary data for package arviz.
    arviz will interpret each key as the name of a different random variable.
    Each array should have shape (chains, draws, *shape).

    See Also
    --------
    https://arviz-devs.github.io/arviz/index.html
    """
    if not ('MCMC' in str(mod.estimator) or 'VI' in str(mod.estimator)):
        raise Exception("This utility works for model object with MCMC or VI inference only.")

    posterior_samples = mod.get_posterior_samples()
    if len(mod._regressor_col) > 0:
        for i, regressor in enumerate(mod._regressor_col):
            posterior_samples[regressor] = posterior_samples['beta'][:,i]
    params_ = mod._regressor_col

    if incl_noise_params:
        params_ += ['obs_sigma']
    if incl_trend_params:
        params_ += ['gt_pow', 'lt_coef', 'gt_coef', 'gb', 'gl']
    if incl_smooth_params:
        params_ += ['lev_sm', 'slp_sm', 'sea_sm']

    params_ = [x for x in params_ if x in posterior_samples.keys()]

    for key in posterior_samples.copy().keys():
        if key not in params_: del posterior_samples[key]

    for key, val in posterior_samples.items():
        posterior_samples[key] = val.reshape((mod.estimator.chains,
                                              mod.estimator._num_sample_per_chain,
                                              *val.shape[1:]))

    return posterior_samples