code: def pystan_noncentered_schools(data, draws, chains):
      """Non-centered eight schools implementation for pystan."""
      schools_code = """
          data {
              int<lower=0> J;
              array[J] real y;
              array[J] real<lower=0> sigma;
          }
  
          parameters {
              real mu;
              real<lower=0> tau;
              array[J] real eta;
          }
  
          transformed parameters {
              array[J] real theta;
              for (j in 1:J)
                  theta[j] = mu + tau * eta[j];
          }
  
          model {
              mu ~ normal(0, 5);
              tau ~ cauchy(0, 5);
              eta ~ normal(0, 1);
              y ~ normal(theta, sigma);
          }
  
          generated quantities {
              array[J] real log_lik;
              array[J] real y_hat;
              for (j in 1:J) {
                  log_lik[j] = normal_lpdf(y[j] | theta[j], sigma[j]);
                  y_hat[j] = normal_rng(theta[j], sigma[j]);
              }
          }
      """
      if pystan_version() == 2:
          import pystan  # pylint: disable=import-error
  
          stan_model = pystan.StanModel(model_code=schools_code)
          fit = stan_model.sampling(
              data=data,
              iter=draws + 500,
              warmup=500,
              chains=chains,
              check_hmc_diagnostics=False,
              control=dict(adapt_engaged=False),
          )
      else:
          import stan  # pylint: disable=import-error
  
          stan_model = stan.build(schools_code, data=data)
          fit = stan_model.sample(
              num_chains=chains,
              num_samples=draws,
              num_warmup=500,
              save_warmup=True,
          )
      return stan_model, fit
  
imports: import gzip
  import importlib
  import logging
  import os
  import sys
  from typing import Any, Dict, List, Optional, Tuple, Union
  import cloudpickle
  import numpy
  import pytest
  from _pytest.outcomes import Skipped
  from packaging.version import Version
  from ..data import InferenceData, from_dict
label_desc: Use image node_id 20 for calling a global function with example usage: pystan_noncentered_schools(data, draws, chains) and returns: stan_model,  fit