code: def rotate(geom, angle, origin="center", use_radians=False):
      r"""Returns a rotated geometry on a 2D plane.
  
      The angle of rotation can be specified in either degrees (default) or
      radians by setting ``use_radians=True``. Positive angles are
      counter-clockwise and negative are clockwise rotations.
  
      The point of origin can be a keyword 'center' for the bounding box
      center (default), 'centroid' for the geometry's centroid, a Point object
      or a coordinate tuple (x0, y0).
  
      The affine transformation matrix for 2D rotation is:
  
        / cos(r) -sin(r) xoff \
        | sin(r)  cos(r) yoff |
        \   0       0      1  /
  
      where the offsets are calculated from the origin Point(x0, y0):
  
          xoff = x0 - x0 * cos(r) + y0 * sin(r)
          yoff = y0 - x0 * sin(r) - y0 * cos(r)
      """
      if geom.is_empty:
          return geom
      if not use_radians:  # convert from degrees
          angle = angle * pi / 180.0
      cosp = cos(angle)
      sinp = sin(angle)
      if abs(cosp) < 2.5e-16:
          cosp = 0.0
      if abs(sinp) < 2.5e-16:
          sinp = 0.0
      x0, y0 = interpret_origin(geom, origin, 2)
  
      # fmt: off
      matrix = (cosp, -sinp, 0.0,
                sinp, cosp, 0.0,
                0.0, 0.0, 1.0,
                x0 - x0 * cosp + y0 * sinp, y0 - x0 * sinp - y0 * cosp, 0.0)
      # 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 3 for calling a global function with example usage: rotate(geom, angle, origin, use_radians) and returns: affine_transform, geom