code: def gdf_to_geojson(
      gdf, date_format="epoch", properties=None, filename=None
  ):
      """Serialize a GeoPandas dataframe to a geojson format Python dictionary / file"""
  
      # convert dates/datetimes to preferred string format if specified
      gdf = convert_date_columns(gdf, date_format)
  
      gdf_out = gdf[["geometry"] + properties or []]
  
      geojson_str = gdf_out.to_json()
  
      if filename:
          with codecs.open(filename, "w", "utf-8-sig") as f:
              f.write(geojson_str)
          return None
      else:
          return json.loads(geojson_str)
  
imports: import base64
  import codecs
  import datetime
  from io import BytesIO
  import json
  import re
  from chroma import Color, Scale
  from colour import Color
  import geojson
  from matplotlib.image import imsave
  import requests
  from .colors import color_ramps, common_html_colors
  from .errors import SourceDataError, DateConversionError
label_desc: Use image node_id 4 for calling a global function with example usage: gdf_to_geojson(gdf, date_format, properties, filename) and returns: None, json