code: def shape(cls, dataset, gridded=False):
      if cls.packed(dataset):
          array = dataset.data[..., 0]
      else:
          array = dataset.data[dataset.vdims[0].name]
      if not gridded:
          return (
              np.prod(array.shape, dtype=np.intp),
              len(dataset.dimensions()),
          )
      shape_map = dict(zip(array.dims, array.shape))
      return tuple(
          shape_map.get(kd.name, np.nan) for kd in dataset.kdims[::-1]
      )
  
imports: import sys
  import types
  import numpy
  import pandas
  from ..None import util
  from ..dimension import Dimension, asdim, dimension_name
  from ..element import Element
  from ..ndmapping import NdMapping, item_check, sorted_context
  from .grid import GridInterface
  from .interface import DataError, Interface
  from .util import dask_array_module, finite_range
label_desc: Use image node_id 6 for calling the XArrayInterface obj's underlying member method code with example usage: obj.shape(cls, dataset, gridded) and returns: tuple, np,  len