code: def _make_bcast_fn(fn_name, n_event_shapes):
      """Implements functions like mean, variance, etc."""
  
      def fn(self, *args, **kwargs):
          val = getattr(self.distribution, fn_name)(*args, **kwargs)
          single_val_shape = self.batch_shape_tensor()
          if n_event_shapes:
              single_val_shape = ps.concat(
                  [single_val_shape]
                  + [self.event_shape_tensor()] * n_event_shapes,
                  axis=0,
              )
          return tf.broadcast_to(
              val, ps.broadcast_shape(ps.shape(val), single_val_shape)
          )
  
      fn.__name__ = f"_{fn_name}"
      return fn
  
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import auto_composite_tensor
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 1 for calling a global function with example usage: _make_bcast_fn(fn_name, n_event_shapes) and returns: fn, tf