code: def _calc_dic(self):
          
  
          # Find mean deviance
          mean_deviance = np.mean(self.db.trace('deviance')(), axis=0)
  
          # Set values of all parameters to their mean
          for stochastic in self.stochastics:
  
              # Calculate mean of paramter
              try:
                  mean_value = np.mean(
                      self.db.trace(
                          stochastic.__name__)(
                      ),
                      axis=0)
  
                  # Set current value to mean
                  stochastic.value = mean_value
  
              except KeyError:
                  print_(
                      "No trace available for %s. DIC value may not be valid." %
                      stochastic.__name__)
              except TypeError:
                  print_(
                      "Not able to calculate DIC: invalid stochastic %s" %
                      stochastic.__name__)
                  return None
  
          # Return twice deviance minus deviance at means
          return 2 * mean_deviance - self.deviance
docs: Calculates deviance information Criterion