def polynomial2bezier(poly):
if isinstance(poly, poly1d):<EOL><INDENT>c = poly.coeffs<EOL><DEDENT>else:<EOL><INDENT>c = poly<EOL><DEDENT>order = len(c)-<NUM_LIT:1><EOL>if order == <NUM_LIT:3>:<EOL><INDENT>bpoints = (c[<NUM_LIT:3>], c[<NUM_LIT:2>]/<NUM_LIT:3> + c[<NUM_LIT:3>], (c[<NUM_LIT:1>] + <NUM_LIT:2>*c[<NUM_LIT:2>])/<NUM_LIT:3> + c[<NUM_LIT:3>],<EOL>c[<NUM_LIT:0>] + c[<NUM_LIT:1>] + c[<NUM_LIT:2>] + c[<NUM_LIT:3>])<EOL><DEDENT>elif order == <NUM_LIT:2>:<EOL><INDENT>bpoints = (c[<NUM_LIT:2>], c[<NUM_LIT:1>]/<NUM_LIT:2> + c[<NUM_LIT:2>], c[<NUM_LIT:0>] + c[<NUM_LIT:1>] + c[<NUM_LIT:2>])<EOL><DEDENT>elif order == <NUM_LIT:1>:<EOL><INDENT>bpoints = (c[<NUM_LIT:1>], c[<NUM_LIT:0>] + c[<NUM_LIT:1>])<EOL><DEDENT>else:<EOL><INDENT>raise AssertionError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>return bpoints<EOL>
Converts a cubic or lower order Polynomial object (or a sequence of
    coefficients) to a CubicBezier, QuadraticBezier, or Line object as
    appropriate.