code: def scale(geom, xfact=1.0, yfact=1.0, zfact=1.0, origin="center"):
      r"""Returns a scaled geometry, scaled by factors along each dimension.
  
      The point of origin can be a keyword 'center' for the 2D bounding box
      center (default), 'centroid' for the geometry's 2D centroid, a Point
      object or a coordinate tuple (x0, y0, z0).
  
      Negative scale factors will mirror or reflect coordinates.
  
      The general 3D affine transformation matrix for scaling is:
  
          / xfact  0    0   xoff \
          |   0  yfact  0   yoff |
          |   0    0  zfact zoff |
          \   0    0    0     1  /
  
      where the offsets are calculated from the origin Point(x0, y0, z0):
  
          xoff = x0 - x0 * xfact
          yoff = y0 - y0 * yfact
          zoff = z0 - z0 * zfact
      """
      if geom.is_empty:
          return geom
      x0, y0, z0 = interpret_origin(geom, origin, 3)
  
      # fmt: off
      matrix = (xfact, 0.0, 0.0,
                0.0, yfact, 0.0,
                0.0, 0.0, zfact,
                x0 - x0 * xfact, y0 - y0 * yfact, z0 - z0 * zfact)
      # fmt: on
      return affine_transform(geom, matrix)
  
file_path: shapely/shapely/affinity.py
imports: from math import cos, pi, sin, tan
  import numpy
  import shapely
label_desc: Use image node_id 4 for calling a global function with example usage: scale(geom, xfact, yfact, zfact, origin) and returns: affine_transform, geom