def split_polygon_at_grid(geom, grid_width=0.1, current_grid_width=10.0):
    if not geom.is_valid:
        geom = geom.buffer(0)

    for i, split_box in enumerate(tile_bbox(geom.bounds, current_grid_width)):
        try:
            polygon_part = geom.intersection(shapely.geometry.box(*split_box))
        except TopologicalError:
            continue
        if not polygon_part.is_empty and polygon_part.type.endswith('Polygon'):
            if grid_width >= current_grid_width:
                yield polygon_part
            else:
                for part in split_polygon_at_grid(polygon_part, grid_width, current_grid_width/10.0):
                    yield part
Determine if a graph G is weighted
dataset/ETHPy150Open omniscale/imposm/imposm/geom.py/split_polygon_at_grid--crossover with--dataset/ETHPy150Open calliope-project/calliope/calliope/lib/nx_pylab.py/is_weighted