code: def swinnerton_dyer_poly(n, x=None, polys=False):
      """Generates n-th Swinnerton-Dyer polynomial in `x`.
  
      Parameters
      ----------
      n : int
          `n` decides the order of polynomial
      x : optional
      polys : bool, optional
          ``polys=True`` returns an expression, otherwise
          (default) returns an expression.
      """
      if n <= 0:
          raise ValueError(
              "Cannot generate Swinnerton-Dyer polynomial of order %s"
              % n
          )
  
      if x is not None:
          sympify(x)
      else:
          x = Dummy("x")
  
      if n > 3:
          from sympy.functions.elementary.miscellaneous import sqrt
          from .numberfields import minimal_polynomial
  
          p = 2
          a = [sqrt(2)]
          for i in range(2, n + 1):
              p = nextprime(p)
              a.append(sqrt(p))
          return minimal_polynomial(Add(*a), x, polys=polys)
  
      if n == 1:
          ex = x**2 - 2
      elif n == 2:
          ex = x**4 - 10 * x**2 + 1
      elif n == 3:
          ex = x**8 - 40 * x**6 + 352 * x**4 - 960 * x**2 + 576
  
      return PurePoly(ex, x) if polys else ex
  
imports: from sympy.core import Add, Mul, Symbol, sympify, Dummy, symbols
  from sympy.core.containers import Tuple
  from sympy.core.singleton import S
  from sympy.ntheory import nextprime
  from sympy.polys.densearith import dmp_add_term, dmp_neg, dmp_mul, dmp_sqr
  from sympy.polys.densebasic import dmp_zero, dmp_one, dmp_ground, dup_from_raw_dict, dmp_raise, dup_random
  from sympy.polys.domains import ZZ
  from sympy.polys.factortools import dup_zz_cyclotomic_poly
  from sympy.polys.polyclasses import DMP
  from sympy.polys.polytools import Poly, PurePoly
  from sympy.polys.polyutils import _analyze_gens
  from sympy.utilities import subsets, public, filldedent
  from sympy.polys.rings import ring
label_desc: Use image node_id 1 for calling a global function with example usage: swinnerton_dyer_poly(n, x, polys) and returns: unknown, minimal_polynomial