code: def convert_polygons_to_lines(src_polygons, dst_lines, crs=None, add_allone_col=False):
      
      gdf = gpd.read_file(src_polygons)
      geom_coords = gdf["geometry"] # featureset.get(5)["geometry"]["coordinates"]
      lines = []
      row_ids = []
      for i_row, pol in tqdm(enumerate(geom_coords), total=len(geom_coords)):
          boundary = pol.boundary
          if boundary.type == 'MultiLineString':
              for line in boundary:
                  lines.append(line)
                  row_ids.append(i_row)
          else:
              lines.append(boundary)
              row_ids.append(i_row)
  
      gdf_lines = gdf.drop("geometry", axis=1).iloc[row_ids, :]
      gdf_lines["Coordinates"] = lines
      gdf_lines = gpd.GeoDataFrame(gdf_lines, geometry='Coordinates', crs=gdf.crs)
      if crs is not None:
          gdf_lines = gdf_lines.to_crs(crs)
      if add_allone_col:
          gdf_lines["ALLONE"] = 1
      Path(dst_lines).parent.mkdir(exist_ok=True, parents=True)
      gdf_lines.to_file(dst_lines)
      return 0
docs: Convert polygons to lines.
  
      Arguments:
          src_polygons {path to geopandas-readable file} -- Filename of the the polygon vector dataset to be 
              converted to lines.
          dst_lines {[type]} -- Filename where to write the line vector dataset to.
  
      Keyword Arguments:
          crs {dict or str} -- Output projection parameters as string or in dictionary format.
              This will reproject the data when a crs is given (not {None}) (default: {None}).
          add_allone_col {bool} -- Add an additional attribute column with all ones.
              This is useful, e.g. in case you want to use the lines with gdal_proximity afterwards (default: {True}).
  
      Returns:
          int -- Exit code 0 if successeful.