code: def to_device(bf_obj):
      import sys
  
      if sys.version_info >= (2, 7):
          bf = memoryview(bf_obj).tobytes()
      else:
          bf = buffer(bf_obj)
      result = mem_alloc(len(bf))
      memcpy_htod(result, bf)
      return result
  
imports: import os
  import numpy
label_desc: Use image node_id 22 for calling a global function with example usage: to_device(bf_obj) and returns: result