docs: def make_valid_polygon(shape):
      """
      Make a polygon valid. Polygons can be invalid in many ways, such as
      self-intersection, self-touching and degeneracy. This process attempts to
      make a polygon valid while retaining as much of its extent or area as
      possible.
  
      First, we call pyclipper to robustly union the polygon. Using this on its
      own appears to be good for "cleaning" the polygon.
  
      This might result in polygons which still have degeneracies according to
      the OCG standard of validity - as pyclipper does not consider these to be
      invalid. Therefore we follow by using the `buffer(0)` technique to attempt
      to remove any remaining degeneracies.
      """
  
      assert shape.geom_type == 'Polygon'
  
      shape = make_valid_pyclipper(shape)
      assert shape.is_valid
      return shape