I am detecting rooftops and output them as shapley polygons in square, U and L shape. Sometimes the output is in U shape with a very thin rectangle on one side ( true shape is L shape) which needs to be cleaned. I have tried using perimeter/area ratio to detect such parts of a polygon and remove them but I am not able to implement it. An example is shown in figure below.
I am looking for a solution preferably with shapely.
The polygon in the example in GEOJSON can be found here.