code: def _return_bytes(x):
      """return handle"""
      handle = x.v_handle
      if not isinstance(handle, ctypes.c_void_p):
          handle = ctypes.c_void_p(handle)
      arr = ctypes.cast(handle, ctypes.POINTER(DGLByteArray))[0]
      size = arr.size
      res = bytearray(size)
      rptr = (ctypes.c_byte * size).from_buffer(res)
      if not ctypes.memmove(rptr, arr.data, size):
          raise RuntimeError("memmove failed")
      return res
  
file_path: dgl/python/dgl/_ffi/_ctypes/types.py
imports: from __future__ import absolute_import
  import ctypes
  from ..base import _LIB, check_call, py_str
  from ..runtime_ctypes import DGLByteArray, DGLContext, DGLDataType, TypeCode
label_desc: Use image node_id 2 for calling a global function with example usage: _return_bytes(x) and returns: res