<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dot(poly1, poly2):
 """ Dot product of polynomial vectors. Args: poly1 (Poly) : left part of product. poly2 (Poly) : right part of product. Returns: (Poly) : product of poly1 and poly2. Examples: [1, q0, q0^2] 2q0^2+q0 q0^4+q0^2+1 """

    if not isinstance(poly1, Poly) and not isinstance(poly2, Poly):
        return numpy.dot(poly1, poly2)

    poly1 = Poly(poly1)
    poly2 = Poly(poly2)

    poly = poly1*poly2
    if numpy.prod(poly1.shape) <= 1 or numpy.prod(poly2.shape) <= 1:
        return poly
    return chaospy.poly.sum(poly, 0)