code: def distribution_filter_for(bijector):
      """Returns a function checking Distribution compatibility with this bijector.
  
      That is, `distribution_filter_for(bijector)(dist) == True` implies
      that `bijector` can act on `dist` (i.e., they are safe to compose with
      `TransformedDistribution`).
  
      TODO(bjp): Make this sensitive to supports.  Currently assumes `bijector` acts
      on an unconstrained space, and just checks compatible ranks.
  
      Args:
        bijector: A `Bijector` instance to check compatibility with.
  
      Returns:
        filter: A Python callable filtering Distributions for compatibility with
          this bijector.
      """
      if isinstance(bijector, tfb.CholeskyToInvCholesky):
  
          def additional_check(dist):
              return tensorshape_util.rank(
                  dist.event_shape
              ) == 2 and int(dist.event_shape[0]) == int(
                  dist.event_shape[1]
              )
  
      elif isinstance(bijector, tfb.CorrelationCholesky):
  
          def additional_check(dist):
              # The isinstance check will be redundant when the
              # `distribution_eligilibility_filter_for` above has been used, but we keep
              # it here for safety.
              return (
                  isinstance(dist, lkj.LKJ)
                  and dist.input_output_cholesky
              )
  
      else:
          additional_check = lambda dist: True
  
      def distribution_filter(dist):
          if not dtype_util.is_floating(dist.dtype):
              return False
          if bijector.forward_min_event_ndims > tensorshape_util.rank(
              dist.event_shape
          ):
              return False
          return additional_check(dist)
  
      return distribution_filter
  
imports: import collections
  import inspect
  from absl import logging
  import hypothesis.strategies
  import tensorflow.compat.v2
  from tensorflow_probability.python import bijectors
  from tensorflow_probability.python.distributions import lkj
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import hypothesis_testlib
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 6 for calling a global function with example usage: distribution_filter_for(bijector) and returns: distribution_filter, additional_check, unknown, False, False, unknown