code: def sample(cls, dataset, samples=None):
      import ibis
  
      if samples is None:
          samples = []
      dims = dataset.dimensions()
      data = dataset.data
      if all(util.isscalar(s) or len(s) == 1 for s in samples):
          items = [s[0] if isinstance(s, tuple) else s for s in samples]
          return data[data[dims[0].name].isin(items)]
  
      predicates = None
      for sample in samples:
          if util.isscalar(sample):
              sample = [sample]
          if not sample:
              continue
          predicate = None
          for i, v in enumerate(sample):
              p = data[dims[i].name] == ibis.literal(
                  util.numpy_scalar_to_python(v)
              )
              if predicate is None:
                  predicate = p
              else:
                  predicate &= p
          if predicates is None:
              predicates = predicate
          else:
              predicates |= predicate
      return data if predicates is None else data.filter(predicates)
  
imports: import sys
  from collections.abc import Iterable
  from functools import lru_cache
  import numpy
  from packaging.version import Version
  from ..None import util
  from ..element import Element
  from ..ndmapping import NdMapping, item_check, sorted_context
  from .None import pandas
  from .interface import Interface
  from .util import cached
label_desc: Use image node_id 26 for calling the IbisInterface obj's underlying member method code with example usage: obj.sample(cls, dataset, samples) and returns: unknown, data