code: def _all_shapes(thing):
      if isinstance(thing, (tfd.Distribution, bijector.Bijector)):
          # pylint: disable=g-complex-comprehension
          answer = [
              s
              for _, param in thing.parameters.items()
              for s in _all_shapes(param)
          ]
          if isinstance(thing, tfd.TransformedDistribution):
              answer = [thing.batch_shape + s for s in answer]
          if isinstance(thing, tfd.Distribution):
              answer += [thing.batch_shape + thing.event_shape]
          if isinstance(thing, tfd.MixtureSameFamily):
              num_components = (
                  thing.mixture_distribution.logits_parameter().shape[
                      -1
                  ]
              )
              answer += [
                  thing.batch_shape
                  + [num_components]
                  + thing.event_shape
              ]
          return answer
      elif tf.is_tensor(thing):
          return [thing.shape]
      else:
          # Assume the thing is some Python constant like a string or a boolean
          return []
  
imports: import collections
  from absl.testing import parameterized
  import hypothesis
  from hypothesis import strategies
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python import distributions
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.bijectors import expm1
  from tensorflow_probability.python.bijectors import normal_cdf
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.distributions import hypothesis_testlib
  from tensorflow_probability.python.internal import hypothesis_testlib
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.math.psd_kernels import hypothesis_testlib
label_desc: Use image node_id 2 for calling a global function with example usage: _all_shapes(thing) and returns: answer, list, list