code: def _get_best_effort_ndims(
      x,
      expect_ndims=None,
      expect_ndims_at_least=None,
      expect_ndims_no_more_than=None,
  ):
      """Get static ndims if possible.  Fallback on `tf.rank(x)`."""
      ndims_static = _get_static_ndims(
          x,
          expect_ndims=expect_ndims,
          expect_ndims_at_least=expect_ndims_at_least,
          expect_ndims_no_more_than=expect_ndims_no_more_than,
      )
      if ndims_static is not None:
          return ndims_static
      return tf.rank(x)
  
file_path: probability/tensorflow_probability/python/stats/quantiles.py
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 7 for calling a global function with example usage: _get_best_effort_ndims(x, expect_ndims, expect_ndims_at_least, expect_ndims_no_more_than) and returns: tf, ndims_static