code: def test_enum_recycling_mutual_recursion(max_plate_nesting, depth):
      data = (True, False)
      for i in range(depth):
          data = (data, data, False)
  
      def model_(**kwargs):
          def model_leaf(data, state=0, address=""):
              p = pyro.param("p_leaf", torch.ones(10))
              pyro.sample(
                  "leaf_{}".format(address),
                  dist.Bernoulli(p[state]),
                  obs=torch.tensor(1.0 if data else 0.0),
              )
  
          @pyro.markov
          def model1(data, state=0, address=""):
              if isinstance(data, bool):
                  model_leaf(data, state, address)
              else:
                  p = pyro.param("p_branch", torch.ones(10, 10))
                  for branch, letter in zip(data, "abcdefg"):
                      next_state = pyro.sample(
                          "branch_{}".format(address + letter),
                          dist.Categorical(p[state]),
                          infer={"enumerate": "parallel"},
                      )
                      model2(branch, next_state, address + letter)
  
          @pyro.markov
          def model2(data, state=0, address=""):
              if isinstance(data, bool):
                  model_leaf(data, state, address)
              else:
                  p = pyro.param("p_branch", torch.ones(10, 10))
                  for branch, letter in zip(data, "abcdefg"):
                      next_state = pyro.sample(
                          "branch_{}".format(address + letter),
                          dist.Categorical(p[state]),
                          infer={"enumerate": "parallel"},
                      )
                      model1(branch, next_state, address + letter)
  
          return model1(**kwargs)
  
      assert_ok(model_, max_plate_nesting=0, data=data)
  
imports: import contextlib
  import logging
  import os
  from collections import defaultdict
  from queue import LifoQueue
  import pytest
  import torch
  from pyro.infer.enum import iter_discrete_escape, iter_discrete_extend
  from pyro.ops.indexing import Vindex
  from pyro.poutine import Trace
  from pyro.poutine.util import prune_subsample_sites
  from pyro.util import check_traceenum_requirements
label_desc: Use image node_id 11 for calling a global function with example usage: test_enum_recycling_mutual_recursion(max_plate_nesting, depth) and returns: model1