def _orient(shape):
    """
    The Shapely version of the orient function appears to only work on
    Polygons, and fails on MultiPolygons. This is a quick wrapper to allow
    orienting of either.
    """

    assert shape.geom_type in ('Polygon', 'MultiPolygon')

    if shape.geom_type == 'Polygon':
        return orient(shape)

    else:
        polys = []
        for geom in shape.geoms:
            polys.append(orient(geom))
        return MultiPolygon(polys)
def _orient ( shape ) : assert shape . geom_type in ( 'Polygon' , 'MultiPolygon' ) if shape . geom_type == 'Polygon' : return orient ( shape ) else : polys = [ ] for geom in shape . geoms : polys . append ( orient ( geom ) ) return MultiPolygon ( polys )
The Shapely version of the orient function appears to only work on
    Polygons, and fails on MultiPolygons. This is a quick wrapper to allow
    orienting of either.