code: def make_random_buffer(size, target="host", dtype="uint8", ctx=None):
      """Return a host or device buffer with random data."""
      dtype = np.dtype(dtype)
      if target == "host":
          assert size >= 0
          buf = pa.allocate_buffer(size * dtype.itemsize)
          arr = np.frombuffer(buf, dtype=dtype)
          arr[:] = np.random.randint(
              low=0, high=255, size=size, dtype=np.uint8
          )
          return arr, buf
      elif target == "device":
          arr, buf = make_random_buffer(
              size, target="host", dtype=dtype
          )
          dbuf = ctx.new_buffer(size * dtype.itemsize)
          dbuf.copy_from_host(buf, position=0, nbytes=buf.size)
          return arr, dbuf
      raise ValueError("invalid target value")
  
file_path: arrow/python/pyarrow/tests/test_cuda_numba_interop.py
imports: import pytest
  import pyarrow
  import numpy
  from numba.cuda.cudadrv.devicearray import DeviceNDArray
label_desc: Use image node_id 4 for calling a global function with example usage: make_random_buffer(size, target, dtype, ctx) and returns: arr,  buf, arr,  dbuf