code: def _isin(block_table, values, block_indexes):
      block_index_set = set(block_indexes)
  
      def _has_nan_value(v_list):
          for v in v_list:
              if np.isnan(v):
                  return True
  
          return False
  
      if isinstance(values, list):
  
          def _is_in_list(blocks):
              ret_blocks = []
              for bid, block in enumerate(blocks):
                  if bid not in block_index_set:
                      ret_blocks.append(block)
                  elif isinstance(block, torch.Tensor):
                      ret_block = torch.isin(
                          block, torch.Tensor(values)
                      )
                      if _has_nan_value(values):
                          ret_block |= torch.isnan(block)
                      ret_blocks.append(ret_block)
                  elif isinstance(block, np.ndarray):
                      ret_block = np.isin(block, values)
                      if _has_nan_value(values):
                          ret_block |= np.isnan(block)
                      ret_blocks.append(
                          torch.tensor(ret_block, dtype=torch.bool)
                      )
  
          block_table = block_table.mapValues(_is_in_list)
      else:
  
          def _is_in_dict(blocks):
              ret_blocks = []
              for bid, block in enumerate(blocks):
                  if bid not in block_index_set:
                      ret_blocks.append(block)
                      continue
                  elif isinstance(block, torch.Tensor):
                      ret_block = torch.zeros(
                          block.shape, dtype=torch.bool
                      )
                      for offset, in_values in values.get(
                          bid, {}
                      ).items():
                          ret_block[:, offset] = torch.isin(
                              block[:, offset], torch.Tensor(in_values)
                          )
                          if _has_nan_value(in_values):
                              ret_block[:, offset] |= torch.isnan(
                                  block[:, offset]
                              )
                      ret_blocks.append(ret_block)
                  elif isinstance(block, np.ndarray):
                      ret_block = np.zeros(block.shape, dtype=np.bool_)
                      for offset, in_values in values.get(
                          bid, {}
                      ).items():
                          ret_block[:, offset] = np.isin(
                              block[:, offset], in_values
                          )
                          if _has_nan_value(in_values):
                              ret_block[:, offset] = np.isnan(
                                  block[:, offset]
                              )
                      ret_blocks.append(
                          torch.tensor(ret_block, dtype=torch.bool)
                      )
  
          block_table = block_table.mapValues(_is_in_dict)
  
      return block_table
  
imports: import numpy
  import pandas
  import torch
  from ._compress_block import compress_blocks
  from .._dataframe import DataFrame
label_desc: Use image node_id 2 for calling a global function with example usage: _isin(block_table, values, block_indexes) and returns: block_table, False, True