code: def scale(curve, sx, sy=None, origin=0j):
      
  
      if sy is None:
          isy = 1j*sx
      else:
          isy = 1j*sy
  
      def _scale(z):
          if sy is None:
              return sx*z
          return sx*z.real + isy*z.imag          
  
      def scale_bezier(bez):
          p = [_scale(c) for c in bez2poly(bez)]
          p[-1] += origin - _scale(origin)
          return poly2bez(p)
  
      if isinstance(curve, Path):
          return Path(*[scale(seg, sx, sy, origin) for seg in curve])
      elif is_bezier_segment(curve):
          return scale_bezier(curve)
      elif isinstance(curve, Arc):
          if sy is None or sy == sx:
              return Arc(start=sx*(curve.start - origin) + origin,
                         radius=sx*curve.radius,
                         rotation=curve.rotation, 
                         large_arc=curve.large_arc, 
                         sweep=curve.sweep, 
                         end=sx*(curve.end - origin) + origin)
          else:
              raise Exception("\nFor `Arc` objects, only scale transforms "
                              "with sx==sy are implemented.\n")
      else:
          raise TypeError("Input `curve` should be a Path, Line, "
                          "QuadraticBezier, CubicBezier, or Arc object.")
docs: 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