code: def test_agent_devices_change(
      restartable_managed_cluster: ManagedCluster,
  ) -> None:
      managed_cluster = restartable_managed_cluster
      try:
          managed_cluster.kill_agent()
          managed_cluster.dc.restart_stage("agent10")
  
          for _i in range(5):
              agent_data = get_agent_data(conf.make_master_url())
              if len(agent_data) == 0:
                  # Agent has exploded and been wiped due to device mismatch, as expected.
                  break
          else:
              pytest.fail(
                  f"agent with different devices is still present after {_i} ticks: {agent_data}"
              )
      finally:
          managed_cluster.dc.kill_stage("agent10")
          managed_cluster.restart_agent()
  
imports: import logging
  import subprocess
  import time
  import docker
  import pytest
  import requests
  from determined.common import constants
  from determined.common.api import authentication, task_is_ready, task_logs
  from determined.common.api.bindings import experimentv1State
  from tests import api_utils
  from tests import command
  from tests import config
  from tests import experiment
  from tests.cluster.test_users import det_spawn
  from .abstract_cluster import Cluster
  from .managed_cluster import ManagedCluster, get_agent_data
  from .managed_cluster_k8s import ManagedK8sCluster
  from .test_groups import det_cmd, det_cmd_json
  from .utils import assert_command_succeeded, run_command, wait_for_command_state, wait_for_task_state
label_desc: Use image node_id 28 for calling a global function with example usage: test_agent_devices_change(restartable_managed_cluster) without return types