code: def mixtures(
      draw,
      batch_shape=None,
      event_dim=None,
      enable_vars=False,
      depth=None,
      eligibility_filter=lambda name: True,
      validate_args=True,
  ):
      """Strategy for drawing `Mixture` distributions.
  
      The component distributions are drawn from the `distributions` strategy.
  
      Args:
        draw: Hypothesis strategy sampler supplied by `@hps.composite`.
        batch_shape: An optional `TensorShape`.  The batch shape of the resulting
          `MixtureSameFamily` distribution.  The component distribution will have a
          batch shape of 1 rank higher (for the components being mixed).  Hypothesis
          will pick a batch shape if omitted.
        event_dim: Optional Python int giving the size of each of the component
          distribution's parameters' event dimensions.  This is shared across all
          parameters, permitting square event matrices, compatible location and
          scale Tensors, etc. If omitted, Hypothesis will choose one.
        enable_vars: TODO(b/181859346): Make this `True` all the time and put
          variable initialization in slicing_test.  If `False`, the returned
          parameters are all `tf.Tensor`s and not {`tf.Variable`,
          `tfp.util.DeferredTensor` `tfp.util.TransformedVariable`}
        depth: Python `int` giving maximum nesting depth of compound Distributions.
        eligibility_filter: Optional Python callable.  Blocks some Distribution
          class names so they will not be drawn.
        validate_args: Python `bool`; whether to enable runtime assertions.
  
      Returns:
        dists: A strategy for drawing `Mixture` distributions with the specified
          `batch_shape` (or an arbitrary one if omitted).
      """
      if depth is None:
          depth = draw(depths())
  
      if batch_shape is None:
          batch_shape = draw(tfp_hps.shapes())
      if event_dim is None:
          event_dim = draw(hps.integers(min_value=2, max_value=6))
  
      # TODO(b/169441746): Re-enable nesting MixtureSameFamily inside Mixture when
      # the weird edge case gets fixed.
      def nested_eligibility_filter(dist_name):
          # TODO(b/204209547): Re-enable Categorical.
          if dist_name in [
              "Categorical",
              "OrderedLogistic",
              "StoppingRatioLogistic",
              "MixtureSameFamily",
          ]:
              return False
          return eligibility_filter(dist_name)
  
      component_strategy = distributions(
          batch_shape=batch_shape,
          event_dim=event_dim,
          enable_vars=enable_vars,
          eligibility_filter=nested_eligibility_filter,
          depth=depth - 1,
          validate_args=validate_args,
      )
      # Must ensure matching event shapes and dtypes.
      c0 = draw(component_strategy)
      components = [c0] + draw(
          hps.lists(
              component_strategy.filter(
                  lambda d: (d.event_shape, d.dtype)
                  == (c0.event_shape, c0.dtype)
              ),
              min_size=1,
              max_size=5,
          )
      )
      hp.note(
          "Drawing Mixture with components {}; parameters {}".format(
              components, [params_used(c) for c in components]
          )
      )
      cat = draw(
          base_distributions(
              dist_name="Categorical",
              batch_shape=batch_shape,
              event_dim=len(components),
              enable_vars=enable_vars,
              validate_args=validate_args,
          )
      )
      hp.note(
          "Forming Mixture with cat distribution {}; parameters {}".format(
              cat, params_used(cat)
          )
      )
      result_dist = tfd.Mixture(
          cat=cat, components=components, validate_args=validate_args
      )
      if batch_shape != result_dist.batch_shape:
          msg = (
              "Mixture strategy generated a bad batch shape for {}, should have"
              " been {}."
          ).format(result_dist, batch_shape)
          raise AssertionError(msg)
      return result_dist
  
imports: import collections
  import functools
  import inspect
  from absl import logging
  import hypothesis
  from hypothesis import strategies
  import numpy
  import six
  import tensorflow.compat.v2
  from tensorflow_probability.python import distributions
  from tensorflow_probability.python import util
  from tensorflow_probability.python.bijectors import ascending
  from tensorflow_probability.python.bijectors import hypothesis_testlib
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.experimental import distributions
  from tensorflow_probability.python.internal import hypothesis_testlib
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 34 for calling a global function with example usage: mixtures(draw, batch_shape, event_dim, enable_vars, depth, eligibility_filter, validate_args) and returns: result_dist, eligibility_filter, False