code: def _patching_wrapper(
      module: nn.Module,
      inplace: bool,
      patching_fn: Callable[..., Optional[nn.Module]],
      *args,
      **kwargs,
  ) -> nn.Module:
      if not inplace:
          module = copy.deepcopy(module)
      changed = replace_layers_in_module(
          module, patching_fn, *args, **kwargs
      )
      if not changed:
          warnings.warn(
              "No layer was modified by patch_module!", UserWarning
          )
      return module
  
file_path: baal/baal/bayesian/common.py
imports: import copy
  import warnings
  from typing import Callable, Optional
  import torch
  from torch import nn
label_desc: Use image node_id 2 for calling a global function with example usage: _patching_wrapper(module, inplace, patching_fn) and returns: module