code: def polynomial2bezier(poly):
      
      if isinstance(poly, poly1d):
          c = poly.coeffs
      else:
          c = poly
      order = len(c)-1
      if order == 3:
          bpoints = (c[3], c[2]/3 + c[3], (c[1] + 2*c[2])/3 + c[3],
                     c[0] + c[1] + c[2] + c[3])
      elif order == 2:
          bpoints = (c[2], c[1]/2 + c[2], c[0] + c[1] + c[2])
      elif order == 1:
          bpoints = (c[1], c[0] + c[1])
      else:
          raise AssertionError("This function is only implemented for linear, "
                               "quadratic, and cubic polynomials.")
      return bpoints
docs: Converts a cubic or lower order Polynomial object (or a sequence of
      coefficients) to a CubicBezier, QuadraticBezier, or Line object as
      appropriate.