code: def test_decomp_5():
      # Here is our first test of the "hard case" of prime decomposition.
      # We work in a quadratic extension Q(sqrt(d)) where d is 1 mod 4, and
      # we consider the factorization of the rational prime 2, which divides
      # the index.
      # Theory says the form of p's factorization depends on the residue of
      # d mod 8, so we consider both cases, d = 1 mod 8 and d = 5 mod 8.
      for d in [-7, -3]:
          T = Poly(x**2 - d)
          rad = {}
          ZK, dK = round_two(T, radicals=rad)
          p = 2
          P = prime_decomp(p, T, dK=dK, ZK=ZK, radical=rad.get(p))
          if d % 8 == 1:
              assert len(P) == 2
              assert all(P[i].e == 1 and P[i].f == 1 for i in range(2))
              assert prod(Pi**Pi.e for Pi in P) == p * ZK
          else:
              assert d % 8 == 5
              assert len(P) == 1
              assert P[0].e == 1
              assert P[0].f == 2
              assert P[0].as_submodule() == p * ZK
  
imports: from math import prod
  from sympy import QQ, ZZ
  from sympy.abc import x, theta
  from sympy.ntheory import factorint
  from sympy.ntheory.residue_ntheory import n_order
  from sympy.polys import Poly, cyclotomic_poly
  from sympy.polys.matrices import DomainMatrix
  from sympy.polys.numberfields.basis import round_two
  from sympy.polys.numberfields.exceptions import StructureError
  from sympy.polys.numberfields.modules import PowerBasis, to_col
  from sympy.polys.numberfields.primes import prime_decomp, _two_elt_rep, _check_formal_conditions_for_maximal_order
  from sympy.testing.pytest import raises
label_desc: Use image node_id 8 for calling a global function with example usage: test_decomp_5() without return types