code: def _minpoly_pow(ex, pw, x, dom, mp=None):
      """
      Returns ``minpoly(ex**pw, x)``
  
      Parameters
      ==========
  
      ex : algebraic element
      pw : rational number
      x : indeterminate of the polynomial
      dom: ground domain
      mp : minimal polynomial of ``p``
  
      Examples
      ========
  
      >>> from sympy import sqrt, QQ, Rational
      >>> from sympy.polys.numberfields.minpoly import _minpoly_pow, minpoly
      >>> from sympy.abc import x, y
      >>> p = sqrt(1 + sqrt(2))
      >>> _minpoly_pow(p, 2, x, QQ)
      x**2 - 2*x - 1
      >>> minpoly(p**2, x)
      x**2 - 2*x - 1
      >>> _minpoly_pow(y, Rational(1, 3), x, QQ.frac_field(y))
      x**3 - y
      >>> minpoly(y**Rational(1, 3), x)
      x**3 - y
  
      """
      pw = sympify(pw)
      if not mp:
          mp = _minpoly_compose(ex, x, dom)
      if not pw.is_rational:
          raise NotAlgebraic(
              "%s does not seem to be an algebraic element" % ex
          )
      if pw < 0:
          if mp == x:
              raise ZeroDivisionError("%s is zero" % ex)
          mp = _invertx(mp, x)
          if pw == -1:
              return mp
          pw = -pw
          ex = 1 / ex
  
      y = Dummy(str(x))
      mp = mp.subs({x: y})
      n, d = pw.as_numer_denom()
      res = Poly(
          resultant(mp, x**d - y**n, gens=[y]), x, domain=dom
      )
      _, factors = res.factor_list()
      res = _choose_factor(factors, x, ex**pw, dom)
      return res.as_expr()
  
imports: from functools import reduce
  from sympy.core.add import Add
  from sympy.core.exprtools import Factors
  from sympy.core.function import expand_mul, expand_multinomial, _mexpand
  from sympy.core.mul import Mul
  from sympy.core.numbers import I, Rational, pi, _illegal
  from sympy.core.singleton import S
  from sympy.core.symbol import Dummy
  from sympy.core.sympify import sympify
  from sympy.core.traversal import preorder_traversal
  from sympy.functions.elementary.exponential import exp
  from sympy.functions.elementary.miscellaneous import sqrt, cbrt
  from sympy.functions.elementary.trigonometric import cos, sin, tan
  from sympy.ntheory.factor_ import divisors
  from sympy.utilities.iterables import subsets
  from sympy.polys.domains import ZZ, QQ, FractionField
  from sympy.polys.orthopolys import dup_chebyshevt
  from sympy.polys.polyerrors import NotAlgebraic, GeneratorsError
  from sympy.polys.polytools import Poly, PurePoly, invert, factor_list, groebner, resultant, degree, poly_from_expr, parallel_poly_from_expr, lcm
  from sympy.polys.polyutils import dict_from_expr, expr_from_dict
  from sympy.polys.ring_series import rs_compose_add
  from sympy.polys.rings import ring
  from sympy.polys.rootoftools import CRootOf
  from sympy.polys.specialpolys import cyclotomic_poly
  from sympy.utilities import numbered_symbols, public, sift
label_desc: Use image node_id 8 for calling a global function with example usage: _minpoly_pow(ex, pw, x, dom, mp) and returns: res, mp