code: def _broadcast_event_and_samples(event, samples, event_ndims):
      """Broadcasts the event or samples."""
      # This is the shape of self.samples, without the samples axis, i.e. the shape
      # of the result of a call to dist.sample(). This way we can broadcast it with
      # event to get a properly-sized event, then add the singleton dim back at
      # -event_ndims - 1.
      samples_shape = ps.concat(
          [
              ps.shape(samples)[: -event_ndims - 1],
              ps.shape(samples)[ps.rank(samples) - event_ndims :],
          ],
          axis=0,
      )
      event = event * tf.ones(samples_shape, dtype=event.dtype)
      event = tf.expand_dims(event, axis=-event_ndims - 1)
      samples = samples * tf.ones_like(event, dtype=samples.dtype)
  
      return event, samples
  
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import samplers
  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: _broadcast_event_and_samples(event, samples, event_ndims) and returns: event,  samples