code: def device(device_kwargs):
      """Fixture to create a device."""
  
      # internally used by pytest
      __tracebackhide__ = True  # pylint:disable=unused-variable
  
      def _device(wires):
          device_kwargs["wires"] = wires
  
          try:
              dev = qml.device(**device_kwargs)
          except qml.DeviceError:
              dev_name = device_kwargs["name"]
              # exit the tests if the device cannot be created
              pytest.exit(
                  f"Device {dev_name} cannot be created. To run the device tests on an external device, the "
                  f"plugin and all of its dependencies must be installed."
              )
  
          capabilities = dev.capabilities()
          if capabilities.get("model", None) != "qubit":
              # exit the tests if device based on cv model (currently not supported)
              pytest.exit(
                  "The device test suite currently only runs on qubit-based devices."
              )
  
          return dev
  
      return _device
  
file_path: pennylane/pennylane/devices/tests/conftest.py
imports: import argparse
  import os
  import numpy
  import pytest
  from _pytest.runner import pytest_runtest_makereport
  import pennylane
label_desc: Use image node_id 4 for calling a global function with example usage: device(device_kwargs) and returns: _device, dev