code: def _make_summary_statistic(attr):
      """Factory for making summary statistics, eg, mean, mode, stddev."""
  
      def _fn(self):
          if any(
              self._dist_fn_args
          ):  # pylint: disable=protected-access
              raise ValueError(
                  "Can only compute "
                  + attr
                  + " when all distributions are "
                  "independent; {}".format(self.model)
              )
          return (
              self._model_unflatten(  # pylint: disable=protected-access
                  getattr(d(), attr)() for d in self._dist_fn_wrapped
              )
          )  # pylint: disable=protected-access
  
      return _fn
  
imports: import collections
  import functools
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import joint_distribution
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.internal import auto_composite_tensor
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow.python.util import tf_inspect
label_desc: Use image node_id 1 for calling a global function with example usage: _make_summary_statistic(attr) and returns: _fn, self