docs: def optimizeTransforms(element, options):
      """
      Attempts to optimise transform specifications on the given node and its children.
  
      Returns the number of bytes saved after performing these reductions.
      """
      num = 0
  
      for transformAttr in ['transform', 'patternTransform', 'gradientTransform']:
          val = element.getAttribute(transformAttr)
          if val != '':
              transform = svg_transform_parser.parse(val)
  
              optimizeTransform(transform)
  
              newVal = serializeTransform(transform)
  
              if len(newVal) < len(val):
                  if len(newVal):
                      element.setAttribute(transformAttr, newVal)
                  else:
                      element.removeAttribute(transformAttr)
                  num += len(val) - len(newVal)
  
      for child in element.childNodes:
          if child.nodeType == Node.ELEMENT_NODE:
              num += optimizeTransforms(child, options)
  
      return num