'raise polynomial to power `n`
Examples
>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.rings import ring
>>> _, x, y = ring(\'x, y\', ZZ)
>>> p = x + y**2
>>> p**3
x**3 + 3*x**2*y**2 + 3*x*y**4 + y**6'

def __pow__(self, n):

    ring = self.ring
    if (not n):
        if self:
            return ring.one
        else:
            raise ValueError('0**0')
    elif (len(self) == 1):
        (monom, coeff) = list(self.items())[0]
        p = ring.zero
        if (coeff == 1):
            p[ring.monomial_pow(monom, n)] = coeff
        else:
            p[ring.monomial_pow(monom, n)] = (coeff ** n)
        return p
    n = int(n)
    if (n < 0):
        raise ValueError('Negative    exponent')
    elif (n == 1):
        return self.copy()
    elif (n == 2):
        return self.square()
    elif (n == 3):
        return (self * self.square())
    elif (len(self) <= 5):
        return self._pow_multinomial(n)
    else:
        return self._pow_generic(n)
