code: def assert_buffer_equal(
      buffer_and_dtype: Tuple[_CuDFBuffer, Any], cudfcol
  ):
      buf, dtype = buffer_and_dtype
      device_id = cp.asarray(cudfcol.data).device.id
      assert buf.__dlpack_device__() == (2, device_id)
      col_from_buf = build_column(
          _protocol_buffer_to_cudf_buffer(buf),
          protocol_dtype_to_cupy_dtype(dtype),
      )
      # check that non null values are the equals as nulls are represented
      # by sentinel values in the buffer.
      # FIXME: In gh-10202 some minimal fixes were added to unblock CI. But
      # currently only non-null values are compared, null positions are
      # unchecked.
      non_null_idxs = ~cudf.Series(cudfcol).isna()
      assert_eq(
          col_from_buf.apply_boolean_mask(non_null_idxs),
          cudfcol.apply_boolean_mask(non_null_idxs),
      )
      array_from_dlpack = cp.from_dlpack(buf.__dlpack__()).get()
      col_array = cp.asarray(cudfcol.data_array_view(mode="read")).get()
      assert_eq(
          array_from_dlpack[non_null_idxs.to_numpy()].flatten(),
          col_array[non_null_idxs.to_numpy()].flatten(),
      )
  
imports: from typing import Any, Tuple
  import cupy
  import pandas
  import pytest
  import cudf
  from cudf.core._compat import PANDAS_GE_150
  from cudf.core.buffer import as_buffer
  from cudf.core.column import as_column, build_column
  from cudf.core.df_protocol import DataFrameObject, _CuDFBuffer, _CuDFColumn, _DtypeKind, _MaskKind, _protocol_buffer_to_cudf_buffer, from_dataframe, protocol_dtype_to_cupy_dtype
  from cudf.testing._utils import assert_eq
label_desc: Use image node_id 3 for calling a global function with example usage: assert_buffer_equal(buffer_and_dtype, cudfcol) without return types