code: def _validate_cat_and_components(cat, components):
      """Basic checks on `cat` and `components` constructor args."""
  
      if not isinstance(cat, categorical.Categorical):
          raise TypeError(
              "cat must be a Categorical distribution, but saw: %s"
              % cat
          )
      if not components:
          raise ValueError(
              "components must be a non-empty list or tuple"
          )
      if not isinstance(components, (list, tuple)):
          raise TypeError(
              "components must be a list or tuple, but saw: %s"
              % components
          )
      if not all(
          isinstance(c, distribution.Distribution) for c in components
      ):
          raise TypeError(
              "all entries in components must be Distribution instances"
              " but saw: %s" % components
          )
  
imports: import warnings
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import categorical
  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 distribution_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 tensorshape_util
  from tensorflow_probability.python.util.seed_stream import SeedStream
  from tensorflow_probability.python.util.seed_stream import TENSOR_SEED_MSG_PREFIX
label_desc: Use image node_id 1 for calling a global function with example usage: _validate_cat_and_components(cat, components) without return types