code: def unwrap_model(model: nn.Module) -> nn.Module:
      """
      Unwraps a model from potential containers (as used in distributed training).
  
      Args:
          model (`torch.nn.Module`): The model to unwrap.
      """
      # since there could be multiple levels of wrapping, unwrap recursively
      if hasattr(model, "module"):
          return model.module
      else:
          return model
  
imports: import random
  from typing import NamedTuple, Any, Generator, Callable, Dict, Union
  from collections.abc import Mapping
  from enum import Enum
  import numpy
  import torch
  import os
  from pathlib import Path
  import torch.distributed
  from torch import nn
label_desc: Use image node_id 12 for calling a global function with example usage: unwrap_model(model) and returns: model, model