code: def test_multiplicity():
      for b in range(2, 20):
          for i in range(100):
              assert multiplicity(b, b**i) == i
              assert multiplicity(b, (b**i) * 23) == i
              assert multiplicity(b, (b**i) * 1000249) == i
      # Should be fast
      assert multiplicity(10, 10**10023) == 10023
      # Should exit quickly
      assert multiplicity(10**10, 10**10) == 1
      # Should raise errors for bad input
      raises(ValueError, lambda: multiplicity(1, 1))
      raises(ValueError, lambda: multiplicity(1, 2))
      raises(ValueError, lambda: multiplicity(1.3, 2))
      raises(ValueError, lambda: multiplicity(2, 0))
      raises(ValueError, lambda: multiplicity(1.3, 0))
  
      # handles Rationals
      assert multiplicity(10, Rational(30, 7)) == 1
      assert multiplicity(Rational(2, 7), Rational(4, 7)) == 1
      assert multiplicity(Rational(1, 7), Rational(3, 49)) == 2
      assert multiplicity(Rational(2, 7), Rational(7, 2)) == -1
      assert multiplicity(3, Rational(1, 9)) == -2
  
imports: from sympy.concrete.summations import summation
  from sympy.core.containers import Dict
  from sympy.core.mul import Mul
  from sympy.core.power import Pow
  from sympy.core.singleton import S
  from sympy.core.symbol import Symbol
  from sympy.functions.combinatorial.factorials import factorial
  from sympy.core.numbers import Integer, Rational
  from sympy.external.gmpy import gcd
  from sympy.ntheory import totient, factorint, primefactors, divisors, nextprime, primerange, pollard_rho, perfect_power, multiplicity, multiplicity_in_factorial, divisor_count, primorial, pollard_pm1, divisor_sigma, factorrat, reduced_totient
  from sympy.ntheory.factor_ import smoothness, smoothness_p, proper_divisors, antidivisors, antidivisor_count, core, udivisors, udivisor_sigma, udivisor_count, proper_divisor_count, primenu, primeomega, mersenne_prime_exponent, is_perfect, is_abundant, is_deficient, is_amicable, dra, drm, _perfect_power
  from sympy.testing.pytest import raises, slow
  from sympy.utilities.iterables import capture
label_desc: Use image node_id 3 for calling a global function with example usage: test_multiplicity() without return types