code: def test_recur_multi():
      @autoname
      def model1(r=True):
          model2()
          with autoname(name="inter"):
              model2()
              if r:
                  model1(r=False)
          model2()
  
      @autoname
      def model2():
          return sample("y", dist.Normal(0.0, 1.0))
  
      expected_names = [
          "model1/model2/y",
          "model1/inter/model2/y",
          "model1/inter/model1/model2/y",
          "model1/inter/model1/inter/model2/y",
          "model1/inter/model1/model2__1/y",
          "model1/model2__1/y",
      ]
  
      tr = poutine.trace(model1).get_trace()
      actual_names = [
          name
          for name, node in tr.nodes.items()
          if node["type"] == "sample"
          and type(node["fn"]).__name__ != "_Subsample"
      ]
      assert expected_names == actual_names
  
file_path: pyro/tests/contrib/autoname/test_autoname.py
imports: import torch
  import pyro
  import pyro.distributions.torch
  import pyro.poutine
  from pyro.contrib.autoname import autoname, sample
label_desc: Use image node_id 11 for calling a global function with example usage: test_recur_multi() and returns: sample