code: def _extract_batch_shape(x, sample_ndims, event_ndims):
      """Slice out the batch component of `x`'s shape."""
      if x is None:
          return []
      shape = ps.shape(x)
      nd = ps.rank_from_shape(shape)
      return shape[sample_ndims : nd - event_ndims]
  
imports: import collections
  import functools
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import mvn_tril
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.math import linalg
  from tensorflow_probability.python.math.scan_associative import scan_associative
label_desc: Use image node_id 12 for calling a global function with example usage: _extract_batch_shape(x, sample_ndims, event_ndims) and returns: shape, list