code: def test_make_divisible():
      def make_divisible(value, divisor, min_value=None, min_ratio=0.9):
          if min_value is None:
              min_value = divisor
          new_value = MutableExpression.max(
              min_value,
              MutableExpression.to_int(value + divisor / 2)
              // divisor
              * divisor,
          )
          # Make sure that round down does not go down by more than (1-min_ratio).
          return MutableExpression.condition(
              new_value < min_ratio * value,
              new_value + divisor,
              new_value,
          )
  
      def original_make_divisible(
          value, divisor, min_value=None, min_ratio=0.9
      ):
          if min_value is None:
              min_value = divisor
          new_value = max(
              min_value, int(value + divisor / 2) // divisor * divisor
          )
          # Make sure that round down does not go down by more than (1-min_ratio).
          if new_value < min_ratio * value:
              new_value += divisor
          return new_value
  
      values = [4, 8, 16, 32, 64, 128]
      divisors = [2, 3, 5, 7, 15]
      with pytest.raises(
          RuntimeError,
          match=r"^(`__index__` is not allowed on SymbolicExpression|Try to use `SymbolicExpression.to_int)",
      ):
          original_make_divisible(
              Categorical(values, label="value"),
              Categorical(divisors, label="divisor"),
          )
      result = make_divisible(
          Categorical(values, label="value"),
          Categorical(divisors, label="divisor"),
      )
      for value in values:
          for divisor in divisors:
              lst = [
                  value if choice.label == "value" else divisor
                  for choice in result.leaf_symbols()
              ]
              assert result.evaluate(lst) == original_make_divisible(
                  value, divisor
              )
  
              assert result.evaluate(
                  {"value": value, "divisor": divisor}
              ) == original_make_divisible(value, divisor)
  
      assert len(list(result.grid())) == 30
      assert max(result.grid()) == 135
  
imports: import math
  from collections import Counter
  import numpy
  import pytest
  from nni.mutable import *
  from nni.mutable.mutable import _dedup_labeled_mutables, _mutable_equal
label_desc: Use image node_id 2 for calling a global function with example usage: test_make_divisible() and returns: MutableExpression, new_value