code: def _modular_int_factory(mod, dom, symmetric, self):
      # Use flint if available
      if flint is not None:
          try:
              mod = dom.convert(mod)
          except CoercionFailed:
              raise ValueError(
                  "modulus must be an integer, got %s" % mod
              )
  
          # flint's nmod is only for moduli up to 2^64-1 (on a 64-bit machine)
          try:
              flint.nmod(0, mod)
          except OverflowError:
              # Use fmpz_mod
              ctx = flint.fmpz_mod_ctx(mod)
          else:
              # Use nmod
              ctx = lambda x: flint.nmod(x, mod)
  
          return ctx
  
      # Use the Python implementation
      return ModularIntegerFactory(mod, dom, symmetric, self)
  
imports: from sympy.external.gmpy import GROUND_TYPES
  from sympy.core.numbers import int_valued
  from sympy.polys.domains.field import Field
  from sympy.polys.domains.modularinteger import ModularIntegerFactory
  from sympy.polys.domains.simpledomain import SimpleDomain
  from sympy.polys.galoistools import gf_zassenhaus, gf_irred_p_rabin
  from sympy.polys.polyerrors import CoercionFailed
  from sympy.utilities import public
  from sympy.polys.domains.groundtypes import SymPyInteger
label_desc: Use image node_id 1 for calling a global function with example usage: _modular_int_factory(mod, dom, symmetric, ) and returns: ModularIntegerFactory, ctx