code: def test_model_terms_levels():
      rng = np.random.default_rng(121195)
      data = pd.DataFrame(
          {
              "y": rng.normal(size=50),
              "x": rng.normal(size=50),
              "z": reduce(
                  add,
                  [
                      [f"Group {x}"] * 10
                      for x in ["1", "2", "3", "1", "2"]
                  ],
              ),
              "time": list(range(1, 11)) * 5,
              "subject": reduce(
                  add, [[f"Subject {x}"] * 10 for x in range(1, 6)]
              ),
          }
      )
      model = bmb.Model("y ~ x + z + time + (time|subject)", data)
      assert model.response_component.terms["z"].levels == [
          "Group 2",
          "Group 3",
      ]
      assert model.response_component.terms["1|subject"].groups == [
          f"Subject {x}" for x in range(1, 6)
      ]
      assert model.response_component.terms["time|subject"].groups == [
          f"Subject {x}" for x in range(1, 6)
      ]
  
imports: import logging
  from functools import reduce
  from operator import add
  from os.path import dirname, join
  import arviz
  import numpy
  import pandas
  import pymc
  import pytest
  from formulae import design_matrices
  import bambi
  from bambi.terms import CommonTerm, GroupSpecificTerm
label_desc: Use image node_id 14 for calling a global function with example usage: test_model_terms_levels() without return types