code: def broadcast_shapes(*shapes):
      def _broadcast_ab(a, b):
          if a == b or a == 1:
              return b
          if b == 1:
              return a
          raise ValueError("Can't broadcast {} with {}".format(a, b))
  
      def _broadcast_2(s1, s2):
          init_s1 = list(s1)
          init_s2 = list(s2)
          if len(s1) > len(s2):
              return _broadcast_2(s2, s1)
          # Now len(s1) <= len(s2)
          s1 = [1] * (len(s2) - len(s1)) + list(s1)
          try:
              return [_broadcast_ab(a, b) for a, b in zip(s1, s2)]
          except ValueError:
              raise ValueError(
                  "Couldn't broadcast shapes {} and {}".format(
                      init_s1, init_s2
                  )
              )
  
      return functools.reduce(_broadcast_2, shapes)
  
imports: import functools
  import itertools
  from unittest import mock
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import cholesky_util
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.math.psd_kernels import exponentiated_quadratic
  from tensorflow_probability.python.math.psd_kernels import schur_complement
  from tensorflow_probability.python.math.psd_kernels.internal import test_util
label_desc: Use image node_id 1 for calling a global function with example usage: broadcast_shapes() and returns: functools, b, a, _broadcast_2, unknown