code: def calcCubicBounds(pt1, pt2, pt3, pt4):
      """Calculates the bounding rectangle for a quadratic Bezier segment.
  
      Args:
          pt1,pt2,pt3,pt4: Control points of the Bezier as 2D tuples.
  
      Returns:
          A four-item tuple representing the bounding rectangle ``(xMin, yMin, xMax, yMax)``.
  
      Example::
  
          >>> calcCubicBounds((0, 0), (25, 100), (75, 100), (100, 0))
          (0, 0, 100, 75.0)
          >>> calcCubicBounds((0, 0), (50, 0), (100, 50), (100, 100))
          (0.0, 0.0, 100, 100)
          >>> print("%f %f %f %f" % calcCubicBounds((50, 0), (0, 100), (100, 100), (50, 0)))
          35.566243 0.000000 64.433757 75.000000
      """
      (ax, ay), (bx, by), (cx, cy), (dx, dy) = calcCubicParameters(
          pt1, pt2, pt3, pt4
      )
      # calc first derivative
      ax3 = ax * 3.0
      ay3 = ay * 3.0
      bx2 = bx * 2.0
      by2 = by * 2.0
      xRoots = [t for t in solveQuadratic(ax3, bx2, cx) if 0 <= t < 1]
      yRoots = [t for t in solveQuadratic(ay3, by2, cy) if 0 <= t < 1]
      roots = xRoots + yRoots
  
      points = [
          (
              ax * t * t * t + bx * t * t + cx * t + dx,
              ay * t * t * t + by * t * t + cy * t + dy,
          )
          for t in roots
      ] + [pt1, pt4]
      return calcBounds(points)
  
imports: from fontTools.misc.arrayTools import calcBounds, sectRect, rectArea
  from fontTools.misc.transform import Identity
  import math
  from collections import namedtuple
  from math import sqrt, acos, cos, pi
label_desc: Use image node_id 14 for calling a global function with example usage: calcCubicBounds(pt1, pt2, pt3, pt4) and returns: calcBounds