code: def connection_spatialite():
      """
      Return a memory-based SQLite3 connection with SpatiaLite enabled & initialized.
  
      `The sqlite3 module must be built with loadable extension support
      <https://docs.python.org/3/library/sqlite3.html#f1>`_ and
      `SpatiaLite <https://www.gaia-gis.it/fossil/libspatialite/index>`_
      must be available on the system as a SQLite module.
      Packages available on Anaconda meet requirements.
  
      Exceptions
      ----------
      ``AttributeError`` on missing support for loadable SQLite extensions
      ``sqlite3.OperationalError`` on missing SpatiaLite
      """
      sqlite3 = pytest.importorskip("sqlite3")
      try:
          with sqlite3.connect(":memory:") as con:
              con.enable_load_extension(True)
              con.load_extension("mod_spatialite")
              con.execute("SELECT InitSpatialMetaData(TRUE)")
      except Exception:
          con.close()
          pytest.skip("Cannot setup spatialite database")
  
      yield con
      con.close()
  
imports: import os
  import warnings
  import pandas
  import geopandas
  from geopandas import GeoDataFrame, read_file, read_postgis
  import geopandas._compat
  from geopandas.io.sql import _get_conn, _write_postgis
  from geopandas.tests.util import create_postgis, create_spatialite, validate_boro_df
  import pytest
label_desc: Use image node_id 4 for calling a global function with example usage: connection_spatialite() without return types