code: def simplify_spline(path, smooth=None, verbose=False):
      
  
      new_vertices = []
      new_entities = []
      scale = path.scale
  
      for discrete in path.discrete:
          circle = is_circle(discrete,
                             scale=scale,
                             verbose=verbose)
          if circle is not None:
              # the points are circular enough for our high standards
              # so replace them with a closed Arc entity
              new_entities.append(entities.Arc(points=np.arange(3) +
                                               len(new_vertices),
                                               closed=True))
              new_vertices.extend(circle)
              continue
  
          # entities for this path
          entity, vertices = points_to_spline_entity(discrete, smooth=smooth)
          # reindex returned control points
          entity.points += len(new_vertices)
          # save entity and vertices
          new_vertices.extend(vertices)
          new_entities.append(entity)
  
      # create the Path2D object for the result
      simplified = type(path)(entities=new_entities,
                              vertices=new_vertices)
  
      return simplified
docs: Replace discrete curves with b-spline or Arc and
      return the result as a new Path2D object.
  
      Parameters
      ------------
      path : trimesh.path.Path2D
        Input geometry
      smooth : float
        Distance to smooth
  
      Returns
      ------------
      simplified : Path2D
        Consists of Arc and BSpline entities