def scale(curve, sx, sy=None, origin=<NUM_LIT>):
if sy is None:<EOL><INDENT>isy = <NUM_LIT>*sx<EOL><DEDENT>else:<EOL><INDENT>isy = <NUM_LIT>*sy<EOL><DEDENT>def _scale(z):<EOL><INDENT>if sy is None:<EOL><INDENT>return sx*z<EOL><DEDENT>return sx*z.real + isy*z.imag          <EOL><DEDENT>def scale_bezier(bez):<EOL><INDENT>p = [_scale(c) for c in bez2poly(bez)]<EOL>p[-<NUM_LIT:1>] += origin - _scale(origin)<EOL>return poly2bez(p)<EOL><DEDENT>if isinstance(curve, Path):<EOL><INDENT>return Path(*[scale(seg, sx, sy, origin) for seg in curve])<EOL><DEDENT>elif is_bezier_segment(curve):<EOL><INDENT>return scale_bezier(curve)<EOL><DEDENT>elif isinstance(curve, Arc):<EOL><INDENT>if sy is None or sy == sx:<EOL><INDENT>return Arc(start=sx*(curve.start - origin) + origin,<EOL>radius=sx*curve.radius,<EOL>rotation=curve.rotation, <EOL>large_arc=curve.large_arc, <EOL>sweep=curve.sweep, <EOL>end=sx*(curve.end - origin) + origin)<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>
Scales `curve`, about `origin`, by diagonal matrix `[[sx,0],[0,sy]]`.

    Notes:
    ------
    * If `sy` is not specified, it is assumed to be equal to `sx` and 
    a scalar transformation of `curve` about `origin` will be returned.
    I.e.
        scale(curve, sx, origin).point(t) == 
            ((curve.point(t) - origin) * sx) + origin