code: def mr(n, bases):
      """Perform a Miller-Rabin strong pseudoprime test on n using a
      given list of bases/witnesses.
  
      References
      ==========
  
      .. [1] Richard Crandall & Carl Pomerance (2005), "Prime Numbers:
             A Computational Perspective", Springer, 2nd edition, 135-138
  
      A list of thresholds and the bases they require are here:
      https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test#Deterministic_variants
  
      Examples
      ========
  
      >>> from sympy.ntheory.primetest import mr
      >>> mr(1373651, [2, 3])
      False
      >>> mr(479001599, [31, 73])
      True
  
      """
      from sympy.polys.domains import ZZ
  
      n = as_int(n)
      if n < 2:
          return False
      # remove powers of 2 from n-1 (= t * 2**s)
      s = bit_scan1(n - 1)
      t = n >> s
      for base in bases:
          # Bases >= n are wrapped, bases < 2 are invalid
          if base >= n:
              base %= n
          if base >= 2:
              base = ZZ(base)
              if not _test(n, base, s, t):
                  return False
      return True
  
imports: from itertools import count
  from sympy.core.sympify import sympify
  from sympy.external.gmpy import gmpy, gcd, jacobi, is_square, bit_scan1, is_fermat_prp, is_euler_prp, is_selfridge_prp, is_strong_selfridge_prp, is_strong_bpsw_prp
  from sympy.external.ntheory import _lucas_sequence
  from sympy.utilities.misc import as_int, filldedent
label_desc: Use image node_id 6 for calling a global function with example usage: mr(n, bases) and returns: True, False, False