code: def test_datefield_null(tmpdir, driver, field_type):
      """
      Test handling of null values for date, time, datetime types for write capable drivers
      """
  
      def _validate(val, val_exp, field_type, driver):
          if (
              driver == "MapInfo File"
              and field_type == "time"
              and calc_gdal_version_num(2, 0, 0)
              <= get_gdal_version_num()
              < calc_gdal_version_num(3, 1, 1)
          ):
              return val == "00:00:00"
          if val is None or val == "":
              return True
          return False
  
      schema = get_schema(driver, field_type)
      path = str(tmpdir.join(get_temp_filename(driver)))
      values_in = [None]
      records = get_records(driver, values_in)
  
      with fiona.open(path, "w", driver=driver, schema=schema) as c:
          c.writerecords(records)
  
      with fiona.open(path, "r") as c:
          items = [get_field(driver, f) for f in c]
          assert len(items) == 1
  
          assert _validate(
              items[0], None, field_type, driver
          ), f"{items[0]} does not match {None}"
  
imports: import fiona
  from fiona._env import get_gdal_version_num, calc_gdal_version_num
  import pytest
  from fiona.errors import DriverSupportError
  from fiona.rfc3339 import parse_time, parse_datetime
  from .conftest import get_temp_filename
  from fiona.env import GDALVersion
  from fiona.model import Feature
  import datetime
  from fiona.drvsupport import supported_drivers, driver_mode_mingdal, _driver_converts_field_type_silently_to_str, _driver_supports_field, _driver_converts_to_str, _driver_supports_timezones, _driver_supports_milliseconds, _driver_supports_mode
  import pytz
  from pytz import timezone
label_desc: Use image node_id 16 for calling a global function with example usage: test_datefield_null(tmpdir, driver, field_type) and returns: False, unknown, True