code: def convert_global_weights(
      global_weights: Mapping, local_var_dict: MutableMapping
  ) -> tuple[MutableMapping, int]:
      """Helper function to convert global weights to local weights format"""
      # Before loading weights, tensors might need to be reshaped to support HE for secure aggregation.
      model_keys = global_weights.keys()
      n_converted = 0
      for var_name in local_var_dict:
          if var_name in model_keys:
              weights = global_weights[var_name]
              try:
                  # reshape global weights to compute difference later on
                  weights = torch.reshape(
                      torch.as_tensor(weights),
                      local_var_dict[var_name].shape,
                  )
                  # update the local dict
                  local_var_dict[var_name] = weights
                  n_converted += 1
              except Exception as e:
                  raise ValueError(
                      f"Convert weight from {var_name} failed."
                  ) from e
      return local_var_dict, n_converted
  
imports: from __future__ import annotations
  import os
  import time
  from collections.abc import Mapping, MutableMapping
  from typing import Any, cast
  import torch
  import torch.distributed
  from monai.apps.auto3dseg.data_analyzer import DataAnalyzer
  from monai.apps.utils import get_logger
  from monai.auto3dseg import SegSummarizer
  from monai.bundle import BundleWorkflow, ConfigComponent, ConfigItem, ConfigParser, ConfigWorkflow
  from monai.engines import SupervisedEvaluator, SupervisedTrainer, Trainer
  from monai.fl.client import ClientAlgo, ClientAlgoStats
  from monai.fl.utils.constants import ExtraItems, FiltersType, FlPhase, FlStatistics, ModelType, WeightType
  from monai.fl.utils.exchange_object import ExchangeObject
  from monai.networks.utils import copy_model_state, get_state_dict
  from monai.utils import min_version, require_pkg
  from monai.utils.enums import DataStatsKeys
label_desc: Use image node_id 1 for calling a global function with example usage: convert_global_weights(global_weights, local_var_dict) and returns: local_var_dict,  n_converted