code: def random_module(name, nn_module, prior, *args, **kwargs):
      r"""
      .. warning::
          The `random_module` primitive is deprecated, and will be removed
          in a future release. Use :class:`~pyro.nn.module.PyroModule` instead to
          to create Bayesian modules from :class:`torch.nn.Module` instances.
          See the `Bayesian Regression tutorial <http://pyro.ai/examples/bayesian_regression.html>`_
          for an example.
  
      DEPRECATED Places a prior over the parameters of the module `nn_module`.
      Returns a distribution (callable) over `nn.Module`\s, which upon calling
      returns a sampled `nn.Module`.
  
      :param name: name of pyro module
      :type name: str
      :param nn_module: the module to be registered with pyro
      :type nn_module: torch.nn.Module
      :param prior: pyro distribution, stochastic function, or python dict with parameter names
                    as keys and respective distributions/stochastic functions as values.
      :returns: a callable which returns a sampled module
      """
      warnings.warn(
          "The `random_module` primitive is deprecated, and will be removed "
          "in a future release. Use `pyro.nn.Module` to create Bayesian "
          "modules from `torch.nn.Module` instances.",
          FutureWarning,
      )
  
      assert hasattr(
          nn_module, "parameters"
      ), "Module is not a NN module."
      # register params in param store
      lifted_fn = poutine.lift(module, prior=prior)
  
      def _fn():
          nn_copy = copy.deepcopy(nn_module)
          # update_module_params must be True or the lifted module will not update local params
          return lifted_fn(
              name, nn_copy, update_module_params=True, *args, **kwargs
          )
  
      return _fn
  
imports: import copy
  import warnings
  from collections import OrderedDict
  from contextlib import ExitStack, contextmanager
  from inspect import isclass
  from typing import Callable, Iterator, Optional, Sequence, Union
  import torch
  from torch.distributions import constraints
  import pyro.distributions
  import pyro.infer
  import pyro.poutine
  from pyro.distributions.torch_distribution import TorchDistributionMixin
  from pyro.params import param_with_module_name
  from pyro.params.param_store import ParamStoreDict
  from pyro.poutine.plate_messenger import PlateMessenger
  from pyro.poutine.runtime import _MODULE_NAMESPACE_DIVIDER, _PYRO_PARAM_STORE, InferDict, Message, am_i_wrapped, apply_stack, effectful
  from pyro.poutine.subsample_messenger import SubsampleMessenger
  from pyro.util import deep_getattr, set_rng_seed
label_desc: Use image node_id 11 for calling a global function with example usage: random_module(name, nn_module, prior) and returns: _fn, lifted_fn