code: def test_mode_extension_dtype(as_period):
      # GH#41927 preserve dt64tz dtype
      ser = Series([pd.Timestamp(1979, 4, n) for n in range(1, 5)])
  
      if as_period:
          ser = ser.dt.to_period("D")
      else:
          ser = ser.dt.tz_localize("US/Central")
  
      res = ser.mode()
      assert res.dtype == ser.dtype
      tm.assert_series_equal(res, ser)
  
file_path: pandas/pandas/tests/series/test_reductions.py
imports: import numpy
  import pytest
  import pandas
  from pandas import Series
  import pandas._testing
label_desc: Use image node_id 2 for calling a global function with example usage: test_mode_extension_dtype(as_period) without return types