code: def select(cls, dataset, selection_mask=None, **selection):
      if selection_mask is None:
          selection_mask = cls.select_mask(dataset, selection)
      indexed = cls.indexed(dataset, selection)
      data = dataset.data
  
      if isinstance(selection_mask, np.ndarray):
          data = cls._index_ibis_table(data)
          if selection_mask.dtype == np.dtype("bool"):
              selection_mask = np.where(selection_mask)[0]
          data = data.filter(
              data["hv_row_id__"].isin(list(map(int, selection_mask)))
          )
  
          if ibis4():
              data = data.drop("hv_row_id__")
          else:
              # Passing a sequence of fields to `drop` will be removed in Ibis 5.0
              data = data.drop(["hv_row_id__"])
  
      elif selection_mask is not None and not (
          isinstance(selection_mask, list) and not selection_mask
      ):
          data = data.filter(selection_mask)
  
      if (
          indexed
          and data.count().execute() == 1
          and len(dataset.vdims) == 1
      ):
          return data[dataset.vdims[0].name].execute().iloc[0]
      return data
  
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 24 for calling the IbisInterface obj's underlying member method code with example usage: obj.select(cls, dataset, selection_mask) and returns: data, data