code: def test_load_state_priority():
      dht_instances = launch_dht_instances(4)
  
      averagers = []
      for i in range(4):
          averager = hivemind.DecentralizedAverager(
              [
                  torch.randn(3),
                  torch.rand(5),
                  torch.tensor([i], dtype=torch.float32),
              ],
              dht=dht_instances[i],
              start=True,
              prefix="demo-run",
              target_group_size=2,
              allow_state_sharing=i != 1,
          )
          averager.state_sharing_priority = 5 - abs(2 - i)
          averagers.append(averager)
  
      time.sleep(0.5)
      metadata, tensors = averagers[0].load_state_from_peers(timeout=1)
      assert tensors[-1].item() == 2
  
      metadata, tensors = averagers[2].load_state_from_peers(timeout=1)
      assert tensors[-1].item() == 3
  
      averagers[0].state_sharing_priority = 10
      time.sleep(0.2)
  
      metadata, tensors = averagers[2].load_state_from_peers(timeout=1)
      assert tensors[-1].item() == 0
  
      averagers[1].allow_state_sharing = False
      averagers[2].allow_state_sharing = False
      metadata, tensors = averagers[0].load_state_from_peers(timeout=1)
      assert tensors[-1].item() == 3
  
      for averager in averagers:
          averager.shutdown()
      for dht in dht_instances:
          dht.shutdown()
  
imports: import random
  import time
  import numpy
  import pytest
  import torch
  import hivemind
  from hivemind.averaging import DecentralizedAverager
  from hivemind.averaging.allreduce import AveragingMode
  from hivemind.averaging.control import AveragingStage
  from hivemind.averaging.key_manager import GroupKeyManager
  from hivemind.averaging.load_balancing import load_balance_peers
  from hivemind.averaging.partition import AllreduceException
  from hivemind.p2p import PeerID
  from test_utils.dht_swarms import launch_dht_instances
label_desc: Use image node_id 14 for calling a global function with example usage: test_load_state_priority() without return types