code: def device(request):
      # A fixture to wrap a test with a device scope, given a device name.
      # Device instance is passed to the test.
  
      device_name = request.param
      _skip_if_no_cuda_device_available(device_name)
  
      device = chainerx.get_device(device_name)
      device_scope = chainerx.using_device(device)
  
      def finalize():
          device_scope.__exit__()
  
      request.addfinalizer(finalize)
      device_scope.__enter__()
      return device
  
imports: import pytest
  import chainerx.testing
  from chainerx_tests import cuda_utils
label_desc: Use image node_id 10 for calling a global function with example usage: device(request) and returns: device