code: def _rm_redundant_points(self, geometry, geo_type):
          
          if geo_type in ('MultiPoint', 'LineString'):
              close = (geo_type == 'LineString')
              output = []
              for coord in geometry:
                  coord = tuple(coord)
                  if not output or coord != output[-1]:
                      output.append(coord)
              if close and len(output) == 1:
                  output.append(output[0])
              return tuple(output)
          if geo_type in ('MultiLineString', 'Polygon'):
              return [
                  self._rm_redundant_points(c, 'LineString') for c in geometry]
          if geo_type == 'MultiPolygon':
              return [self._rm_redundant_points(c, 'Polygon') for c in geometry]
          return geometry
docs: Remove redundant coordinate pairs from geometry
              geometry: array of coordinates or nested-array of coordinates
              geo_type: GeoJSON type attribute for provided geometry, used to
                       determine structure of provided `geometry` argument