code: def get_ndgrid(hist, get_bin_labels: bool = False, n_dim: int = 2):
      """Get filled n-d grid of first n dimensions of input histogram
  
      :param hist: input histogrammar histogram
      :return: grid of first n dimensions of input histogram
      """
      if hist.n_dim < n_dim:
          warnings.warn(
              f"Input histogram only has {hist.n_dim} dimensions (<{n_dim}). Returning empty grid."
          )
          return np.zeros(tuple([0] * n_dim))
  
      keys = prepare_ndgrid(hist, n_dim)
      grid = set_ndgrid(hist, keys, n_dim)
  
      if get_bin_labels:
          return grid, keys
  
      return grid
  
imports: from __future__ import annotations
  import warnings
  import histogrammar
  import numpy
  from histogrammar.util import get_hist_props
  from popmon.hist.hist_utils import get_bin_centers, is_numeric
  from popmon.stats.numpy import quantile
label_desc: Use image node_id 5 for calling a global function with example usage: get_ndgrid(hist, get_bin_labels, n_dim) and returns: grid, np, grid,  keys