code: def create_postgis(con, df, srid=None, geom_col="geom"):
      """
      Create a nybb table in the test_geopandas PostGIS database.
      Returns a boolean indicating whether the database table was successfully
      created
      """
      # Try to create the database, skip the db tests if something goes
      # wrong
      # If you'd like these tests to run, create a database called
      # 'test_geopandas' and enable postgis in it:
      # > createdb test_geopandas
      # > psql -c "CREATE EXTENSION postgis" -d test_geopandas
      if srid is not None:
          geom_schema = "geometry(MULTIPOLYGON, {})".format(srid)
          geom_insert = (
              "ST_SetSRID(ST_GeometryFromText(%s), {})".format(srid)
          )
      else:
          geom_schema = "geometry"
          geom_insert = "ST_GeometryFromText(%s)"
      try:
          cursor = con.cursor()
          cursor.execute("DROP TABLE IF EXISTS nybb;")
  
          sql = """CREATE TABLE nybb (
              {geom_col}   {geom_schema},
              borocode     integer,
              boroname     varchar(40),
              shape_leng   float,
              shape_area   float
              );""".format(
              geom_col=geom_col, geom_schema=geom_schema
          )
          cursor.execute(sql)
  
          for i, row in df.iterrows():
              sql = """INSERT INTO nybb VALUES ({}, %s, %s, %s, %s
              );""".format(
                  geom_insert
              )
              cursor.execute(
                  sql,
                  (
                      row["geometry"].wkt,
                      row["BoroCode"],
                      row["BoroName"],
                      row["Shape_Leng"],
                      row["Shape_Area"],
                  ),
              )
      finally:
          cursor.close()
          con.commit()
  
imports: import os.path
  from pandas import Series
  from geopandas import GeoDataFrame
  from geopandas.testing import assert_geoseries_equal, geom_almost_equals, geom_equals
label_desc: Use image node_id 4 for calling a global function with example usage: create_postgis(con, df, srid, geom_col) without return types