code: def from_shape(cls, shape):
          
          # NOTE: In the below we replace ``isinstance(a, B)`` with
          #       ``a.__class__ is B``, which is a 3-3.5x speedup.
          if shape.__class__ is cls:
              return shape
  
          else:
              error = linearization_error(shape.nodes)
              if error < _ERROR_VAL:
                  linearized = cls(shape, error)
                  return linearized
  
              else:
                  return shape
docs: Try to linearize a curve (or an already linearized curve).
  
          Args:
              shape (Union[SubdividedCurve, \
              ~bezier._geometric_intersection.Linearization]): A curve or an
                  already linearized curve.
  
          Returns:
              Union[SubdividedCurve, \
              ~bezier._geometric_intersection.Linearization]: The
              (potentially linearized) curve.